You are here

function panels_landing_page_basic in Panels 7.3

Same name and namespace in other branches
  1. 6.3 plugins/page_wizards/landing_page.inc \panels_landing_page_basic()

First page of our page creator wizard.

1 string reference to 'panels_landing_page_basic'
landing_page.inc in plugins/page_wizards/landing_page.inc

File

plugins/page_wizards/landing_page.inc, line 76

Code

function panels_landing_page_basic($form, &$form_state) {
  $cache =& $form_state['wizard cache'];
  ctools_include('dependent');
  $form['admin_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Administrative title'),
    '#description' => t('The name of this page. This will appear in the administrative interface to easily identify it.'),
    '#default_value' => $cache->admin_title,
    '#required' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#title' => t('Machine name'),
    '#machine_name' => array(
      'exists' => 'page_manager_page_load',
      'source' => array(
        'admin_title',
      ),
    ),
    '#description' => t('The machine readable name of this page. It must be unique, and it must contain only alphanumeric characters and underscores. Once created, you will not be able to change this value!'),
    '#default_value' => $cache->name,
  );
  $form['admin_description'] = array(
    '#type' => 'textarea',
    '#title' => t('Administrative description'),
    '#description' => t('A description of what this page is, does or is for, for administrative use.'),
    '#default_value' => $cache->admin_description,
  );

  // Path.
  $form['path'] = array(
    '#type' => 'textfield',
    '#title' => t('Path'),
    '#default_value' => $cache->path,
    '#field_prefix' => url(NULL, array(
      'absolute' => TRUE,
    )) . (variable_get('clean_url', 0) ? '' : '?q='),
    '#required' => TRUE,
  );
  $form['menu_entry'] = array(
    '#type' => 'checkbox',
    '#default_value' => $cache->menu_entry,
    '#title' => t('Add a visible menu entry for this page'),
  );
  $form['menu']['#tree'] = TRUE;
  $form['menu']['title'] = array(
    '#title' => t('Menu title'),
    '#type' => 'textfield',
    '#default_value' => $cache->menu['title'],
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-menu-entry' => array(
        1,
      ),
    ),
  );

  // Only display the menu selector if menu module is enabled.
  if (module_exists('menu')) {
    $form['menu']['name'] = array(
      '#title' => t('Menu'),
      '#type' => 'select',
      '#options' => menu_get_menus(),
      '#default_value' => $cache->menu['name'],
      '#process' => array(
        'ctools_dependent_process',
      ),
      '#dependency' => array(
        'edit-menu-entry' => array(
          1,
        ),
      ),
    );
  }
  else {
    $form['menu']['name'] = array(
      '#type' => 'value',
      '#value' => $cache->menu['name'],
    );
    $form['menu']['markup'] = array(
      '#value' => t('Menu selection requires the activation of menu module.'),
    );
  }
  $form['menu']['weight'] = array(
    '#title' => t('Weight'),
    '#type' => 'textfield',
    '#default_value' => isset($cache->menu['weight']) ? $cache->menu['weight'] : 0,
    '#description' => t('The lower the weight the higher/further left it will appear.'),
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-menu-entry' => array(
        1,
      ),
    ),
  );
  ctools_include('page-wizard', 'panels');
  panels_page_wizard_add_layout($form, $form_state);

  // Ensure all 'page' features are loaded.
  $page_task = page_manager_get_task('page');
  return $form;
}