You are here

public function PanelizerEntityNode::hook_page_alter in Panelizer 7.2

Same name and namespace in other branches
  1. 7.3 plugins/entity/PanelizerEntityNode.class.php \PanelizerEntityNode::hook_page_alter()

File

plugins/entity/PanelizerEntityNode.class.php, line 217
Class for the Panelizer node entity plugin.

Class

PanelizerEntityNode
Panelizer Entity node plugin class.

Code

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

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

    // Modify the header.
    $table['#header'][1]['colspan'] = 5;

    // Since we can't tell what row a type is for, but we know that they
    // were generated in this order, go through the original types
    // list:
    $types = node_type_get_types();
    $names = node_type_get_names();
    $row_index = 0;
    foreach ($names as $bundle => $name) {
      $type = $types[$bundle];
      if (node_hook($type->type, 'form')) {
        $type_url_str = str_replace('_', '-', $type->type);
        if ($this
          ->is_panelized($bundle) && panelizer_administer_entity_bundle($this, $bundle)) {
          $table['#rows'][$row_index][] = array(
            'data' => l(t('panelizer'), 'admin/structure/types/manage/' . $type_url_str . '/panelizer'),
          );
        }
        else {
          $table['#rows'][$row_index][] = array(
            'data' => '',
          );
        }

        // Update row index for next pass:
        $row_index++;
      }
    }
  }
}