You are here

function panels_node_override_basic in Panels 6.3

First page of our page creator wizard.

1 string reference to 'panels_node_override_basic'
node_override.inc in plugins/page_wizards/node_override.inc

File

plugins/page_wizards/node_override.inc, line 73

Code

function panels_node_override_basic(&$form, &$form_state) {
  $types = node_get_types();
  $form_state['types'] = $types;
  $already_done = array();

  // Figure out which types already have variants assigned to them.
  foreach ($form_state['page']->handlers as $name => $handler) {
    if ($handler->handler == 'panel_context' && !empty($handler->conf['access']['plugins'])) {
      foreach ($handler->conf['access']['plugins'] as $plugin) {
        if ($plugin['name'] == 'node_type') {
          foreach ($plugin['settings']['type'] as $type) {
            $already_done[$type] = $name;
          }
        }
      }
    }
  }
  if ($already_done) {
    $items = array();
    foreach ($already_done as $type => $handler_id) {
      $items[] = check_plain($types[$type]->name) . ' ' . l(t('[Edit]'), page_manager_edit_url($form_state['page']->task_name, array(
        'handlers',
        $handler_id,
        'content',
      )));
    }
    $form['already_done'] = array(
      '#type' => 'item',
      '#title' => t('Existing node templates'),
      '#value' => theme('item_list', $items),
    );
  }
  $options = array();
  foreach ($types as $name => $type) {
    if (empty($already_done[$name])) {
      $options[$name] = $type->name;
    }
  }
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Node type'),
    '#options' => $options,
    '#default_value' => $form_state['cache']->type,
  );
  ctools_include('page-wizard', 'panels');
  panels_page_wizard_add_layout($form, $form_state);
}