function panopoly_pages_modules_enabled in Panopoly Pages 7
Implements hook_modules_enabled().
This hook is implemented to assign some default permissions for Panelizer's handling of taxonomy terms. This has to be done in this hook to run after both features and defaultconfig which power the functionality. Hopefully a more general solution can be found.
See also
http://drupal.org/node/1837312
File
- ./
panopoly_pages.module, line 55
Code
function panopoly_pages_modules_enabled($modules) {
// Only run this logic if we are executing as part of an install profile
// And only for this particular module.
if (drupal_installation_attempted() && in_array('panopoly_pages', $modules)) {
// Rebuild some caches so this all works right.
features_revert_module('panopoly_pages');
drupal_static_reset('panelizer_entity_plugin_get_handler');
$roles = array(
'editor',
'administrator',
);
$content_types = array(
'panopoly_page',
'panopoly_landing_page',
);
$components = array(
'breadcrumbs',
'content',
'context',
'defaults',
'layout',
'overview',
'settings',
);
// Setup some default permissions for Panelizer.
foreach ($roles as $role_name) {
$role = user_role_load_by_name($role_name);
foreach ($content_types as $content_type) {
foreach ($components as $component) {
user_role_grant_permissions($role->rid, array(
"administer panelizer node {$content_type} {$component}",
));
}
}
}
}
}