function optimizely_permission() {
return array(
'administer optimizely' => array(
'title' => t('Administer Optimizely module'),
'description' =>
t('Administer access to everything in module'),
'restrict access' => TRUE,What's different is that the permissions defined in hook_permission() are then used in the .routing.yml file to control access to specific paths. For instance,
),
);
}
optimizely.settings:
path: /admin/config/system/optimizely
# ...
requirements:
_permission: administer optimizely
Update for Drupal 8, beta 1: hook_permission() has been removed. Its functionality is now provided by the .permissions.yml file. See http://optimizely-to-drupal-8.blogspot.com/2014/11/hookpermission-has-disappeared.html
Source:
DRUPAL 8 INFO HOOK TO PLUGIN, DrupalCon Prague, Sept 2013
https://groups.drupal.org/files/pwolanin-2013-09-info-hook-plugin-d.pdf
This presentation states: "Info hooks that simply return a data array - like hook_permission() - without associated functionality - are not candidates to become plugins." I take this to mean that these kinds of hooks will largely remain unchanged.
No comments:
Post a Comment