panopoly_pages.module in Panopoly Pages 7
File
panopoly_pages.module
View source
<?php
include_once 'panopoly_pages.features.inc';
function panopoly_pages_form_panels_ipe_edit_control_form_alter(&$form, &$form_state) {
if (empty($form_state['renderer'])) {
return;
}
$renderer = $form_state['renderer'];
$cache_key = $renderer->display->cache_key;
list($module, $type, $key) = explode(':', $cache_key, 3);
if ($module != 'panelizer' || $type != 'node') {
return;
}
list($nid, $view_mode) = explode(':', $key);
if (($node = node_load($nid)) && $node->type == 'panopoly_landing_page') {
$form['buttons']['submit']['#value'] = t('Save');
unset($form['buttons']['revert_default']);
unset($form['buttons']['save_default']);
}
}
function panopoly_pages_module_implements_alter(&$implementations, $hook) {
if (($hook == 'form_alter' || $hook == 'modules_enabled') && isset($implementations['panopoly_pages'])) {
$group = $implementations['panopoly_pages'];
unset($implementations['panopoly_pages']);
$implementations['panopoly_pages'] = $group;
}
}
function panopoly_pages_modules_enabled($modules) {
if (drupal_installation_attempted() && in_array('panopoly_pages', $modules)) {
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',
);
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}",
));
}
}
}
}
}