Status | ||||
---|---|---|---|---|
|
Info |
---|
Drupal 7 The information below is most suited to Drupal 7. It may or not be applicable to later versions of Drupal |
...
Code Block | ||
---|---|---|
| ||
/** * Implements hook_entity_info_alter() */ function YOUR_FEATURE_NAME_entity_info_alter(&$entity_info) { $entity_info['fieldable_panels_pane']['bundles']['YOUR_FEATURE_NAME'] = array( 'label' => t('YOUR FEATURE NAME'), 'pane category' => t('YOUR FEATURE CATEGORY'), 'pane top level' => FALSE, 'pane icon' => drupal_get_path('module', 'panopoly_widgets') . '/images/icon_image.png', 'admin' => array( 'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type', 'bundle argument' => 4, 'real path' => 'admin/structure/fieldable-panels-panes/manage/YOUR_FEATURE_NAME', 'access arguments' => array('administer fieldable panels panes'), ), ); } /** * Implements hook_theme_registry_alter(). */ function YOUR_FEATURE_NAME_theme_registry_alter(&$theme_registry) { // add template file $mod_path = drupal_get_path('module', 'YOUR_FEATURE_NAME') . '/templates'; $theme_registry_copy = $theme_registry; // munge on a copy _theme_process_registry($theme_registry_copy, 'phptemplate', 'theme_engine', 'pow', $mod_path); $theme_registry += array_diff_key($theme_registry_copy, $theme_registry); $hooks = array('node'); foreach ($hooks as $h) { _YOUR_FEATURE_NAME_insert_after_first_element($theme_registry[$h]['theme paths'], $mod_path); } $theme_registry['fieldable_panels_panes__YOUR_FEATURE_NAME'] = array( 'template' => drupal_get_path('module', 'YOUR_FEATURE_NAME') . '/templates/fieldable-panels-panes--YOUR-FEATURE-NAME', 'theme path' => drupal_get_path('module', 'YOUR_FEATURE_NAME'), 'type' => 'module', ); } /** * Helper function for re-ordering arrays (needed by theme_registry_alter) * * http://www.metachunk.com/blog/adding-module-path-drupal-7-theme-registry */ function _YOUR_FEATURE_NAME_insert_after_first_element(&$a, $element) { if (is_array($a)) { $first_element = array_shift($a); array_unshift($a, $first_element, $element); } } /** * Implements hook_preprocess_panels_pane(). */ function YOUR_FEATURE_NAME_preprocess_panels_pane(&$variables){ if(isset($variables['content']['#bundle'])){ $bundle = $variables['content']['#bundle']; if (strpos($bundle, 'YOUR_FEATURE_NAME') === 0){ $variables['theme_hook_suggestions'][] = 'fieldable_panels_panes__YOUR_FEATURE_NAME'; } } } |
Review History
...
Who
...
When
...
Status
...
Bob
...
20230509
...
...
Review History
Who | When | Status |
---|---|---|
Bob | 20230525 | Drupal 7 |