You are here

public function PanelizerEntityBean::hook_page_alter in Bean (for Drupal 7) 7

Implements a delegated hook_page_alter.

Add panelizer links to the block types page.

File

plugins/entity/PanelizerEntityBean.class.php, line 82
Class for the Panelizer bean entity plugin.

Class

PanelizerEntityBean
Panelizer Entity bean plugin class.

Code

public function hook_page_alter(&$page) {
  if ($_GET['q'] == 'admin/structure/block-types' && !empty($page['content']['system_main']['bean_table'])) {

    // shortcut
    $table =& $page['content']['system_main']['bean_table'];

    // Modify the header.
    $table['#header'][2]['colspan'] = 5;
    $bean_info = bean_entity_info();
    $names = $bean_info['bean']['bundles'];
    foreach ($names as $bundle => $name) {

      // @see bean_admin_ui_admin_page() for information on why we have to
      // append '_0'.
      $type_url_str = str_replace(' ', '', $name['label'] . '_0');
      if ($this
        ->is_panelized($bundle) && panelizer_administer_entity_bundle($this, $bundle)) {
        $table['#rows'][$type_url_str][] = array(
          'data' => l(t('panelizer'), 'admin/structure/block-types/manage/' . $bundle . '/panelizer'),
        );
      }
      else {
        $table['#rows'][$type_url_str][] = array(
          'data' => '',
        );
      }
    }
  }
}