public function PanelizerEntityDefault::hook_panelizer_defaults in Panelizer 7.2
Same name and namespace in other branches
- 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::hook_panelizer_defaults()
Implements a delegated hook_panelizer_defaults().
This makes sure that all panelized entities configured to have a default actually have one.
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 1285 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
public function hook_panelizer_defaults(&$panelizers) {
// For features integration, if they have modified a default and put
// it into the database, we do not want to show one as a default.
// Otherwise, features can't latch onto it.
$default_names =& drupal_static('panelizer_defaults_in_database', NULL);
if (!isset($default_names)) {
$default_names = drupal_map_assoc(db_query("SELECT name FROM {panelizer_defaults} WHERE name LIKE '%:default'")
->fetchCol());
}
foreach ($this->plugin['bundles'] as $bundle => $info) {
if (!empty($info['status']) && !empty($info['default'])) {
$panelizer = $this
->get_internal_default_panelizer($bundle);
if (empty($default_names[$panelizer->name]) && !isset($panelizers[$panelizer->name])) {
$panelizers[$panelizer->name] = $panelizer;
}
}
}
}