跳转到主要内容
learningxm 提交于 1 December 2012

drupal_access_denied()替换为 AccessDeniedHttpException()

drupal_not_fount()替换为 NotFoundHttpException();

drupal7没有权限

drupal_access_denied(); drupal_exit();

drupal8替换为

throw new AccessDeniedHttpException();

drupal7没有找到

drupal_not_found(); drupal_exit();

drupal8替换为

throw new NotFoundHttpException();

别忘了调用类库:

use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

learningxm 提交于 1 December 2012

 

几个核心控制类库位置   'entity class' => 'Drupal\Core\Entity\Entity',  'controller class' => 'Drupal\Core\Entity\DatabaseStorageController',  'list controller class' => 'Drupal\Core\Entity\EntityListController',  'render controller class' => 'Drupal\Core\Entity\EntityRenderController',  'form controller class' => array(   'default' => 'Drupal\Core\Entity\EntityFormController', ), 
learningxm 提交于 1 December 2012

comment_form_node_form_alter两个变化:

1、$node的获取

drupal8

$node = $form_state['controller']->getEntity($form_state);

drupal7

$node = $form['#node'];

2、js的添加

drupal8

'#attached' => array( 'library' => array(array('comment', 'drupal.comment')), ),

drupal7

'#attached' => array( 'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), ),

具体代码参考api

订阅