You are here

function panels_breadcrumbs_variant_breadcrumb_form in Panels Breadcrumbs 7

Same name and namespace in other branches
  1. 7.2 panels_breadcrumbs.module \panels_breadcrumbs_variant_breadcrumb_form()

Panels breadcrumbs configuration form.

1 string reference to 'panels_breadcrumbs_variant_breadcrumb_form'
panels_breadcrumbs_page_manager_variant_operations_alter in ./panels_breadcrumbs.module
Implements hook_page_manager_variant_operations_alter().

File

./panels_breadcrumbs.module, line 37
Main file for panels breadcrumbs module.

Code

function panels_breadcrumbs_variant_breadcrumb_form($form, &$form_state) {
  ctools_include('context-task-handler');
  $handler =& $form_state['handler'];
  $contexts = ctools_context_handler_get_all_contexts($form_state['task'], $form_state['subtask'], $handler);
  if (empty($handler->conf['panels_breadcrumbs_state'])) {
    $handler->conf['panels_breadcrumbs_state'] = '0';
  }
  if (empty($handler->conf['panels_breadcrumbs_titles'])) {
    $handler->conf['panels_breadcrumbs_titles'] = '';
  }
  if (empty($handler->conf['panels_breadcrumbs_paths'])) {
    $handler->conf['panels_breadcrumbs_paths'] = '';
  }
  $form['settings']['panels_breadcrumbs_state'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Breadcrumbs for this Variant'),
    '#default_value' => $handler->conf['panels_breadcrumbs_state'],
  );
  $form['settings']['panels_breadcrumbs_titles'] = array(
    '#type' => 'textarea',
    '#title' => t('Breadcrumb titles'),
    '#description' => t('Enter one title per line.'),
    '#default_value' => $handler->conf['panels_breadcrumbs_titles'],
  );
  $form['settings']['panels_breadcrumbs_paths'] = array(
    '#type' => 'textarea',
    '#title' => t('Breadcrumb paths'),
    '#description' => t('Enter one path per line. You can use @front to link
      to the front page, or @none for no link.', array(
      '@front' => '<front>',
      '@none' => '<none>',
    )),
    '#default_value' => $handler->conf['panels_breadcrumbs_paths'],
  );
  $form['settings']['panels_breadcrumbs_home'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prepend Home Link to the Breadcrumb'),
    '#default_value' => isset($handler->conf['panels_breadcrumbs_home']) ? $handler->conf['panels_breadcrumbs_home'] : TRUE,
  );
  $rows = array();
  foreach ($contexts as $context) {
    foreach (ctools_context_get_converters('%' . check_plain($context->keyword) . ':', $context) as $keyword => $title) {
      $rows[] = array(
        check_plain($keyword),
        t('@identifier: @title', array(
          '@title' => $title,
          '@identifier' => $context->identifier,
        )),
      );
    }
  }
  $header = array(
    t('Keyword'),
    t('Value'),
  );
  $form['contexts'] = array(
    '#type' => 'fieldset',
    '#title' => t('Substitutions'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#value' => theme('table', array(
      'header' => $header,
      'rows' => $rows,
    )),
  );
  return $form;
}