Cms技巧
分享创造价值 合作实现共赢

Cms技巧

当前位置: 首页 > 新闻动态 > Cms技巧

drupal8和drupal7模块通用的方式讲解

发布时间:2019-12-16 11:15:49作者:admin点击:

drupal8的bate版本出来了,自己没事瞎琢磨下,发现目录结构变化了很多,网站的theme和module该到了根目录themes和modules里面。 同时兼容d7的方式sites/all/的方式

在sites下的readme 是这么说的,大意差不多

This directory structure contains the settings and configuration files specific
to your site or sites and is an integral part of multisite configurations.

It is now recommended to place your custom and downloaded extensions in the
/modules, /themes, and /profiles directories located in the Drupal root. The
sites/all/ subdirectory structure, which was recommended in previous versions
of Drupal, is still supported.

See core/INSTALL.txt for information about single-site installation or
multisite configuration.

关于模块

然后看了下d8的模块目录,看了下dblog模块,发现这个就是watchdog的记录插入数据库方式

name.module文件最醒目,和d7差不多


/**
* @file
* System monitoring and logging for administrators.
*
* The Database Logging module monitors your site and keeps a list of recorded
* events containing usage and performance data, errors, warnings, and similar
* operational information.
*
* @see watchdog()
*/

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;

/**
* Implements hook_help().
*/
function dblog_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.dblog':
$output = '';
$output .= '

' . t('About') . '

';
$output .= '

' . t('The Database Logging module logs system events in the Drupal database. For more information, see the online handbook entry for the Database Logging module.', array('!dblog' => 'http://drupal.org/documentation/modules/dblog')) . '

';
$output .= '

' . t('Uses') . '

';
$output .= '
';
$output .= '
' . t('Monitoring your site') . '
';
$output .= '
' . t('The Database Logging module allows you to view an event log on the Recent log messages page. The log is a chronological list of recorded events containing usage data, performance data, errors, warnings and operational information. Administrators should check the log on a regular basis to ensure their site is working properly.', array('!dblog' => \Drupal::url('dblog.overview'))) . '
';

TOP

QQ客服

18910140161