You are here

function _ds_extras_page_title_options in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.admin.inc \_ds_extras_page_title_options()

Helper function to show the page title options. Used in Field UI and Panels editor.

2 calls to _ds_extras_page_title_options()
ds_extras_field_ui_alter in modules/ds_extras/ds_extras.admin.inc
Alter Manage display screen.
ds_panels_layout in modules/ds_extras/ds_extras.panels.inc
Return the Panels layout settings form.

File

modules/ds_extras/ds_extras.admin.inc, line 678
Display Suite Extras administrative functions.

Code

function _ds_extras_page_title_options($settings, $entity_type) {
  $return['page_option_type'] = array(
    '#type' => 'select',
    '#title' => t('Page title'),
    '#options' => array(
      '0' => t('Show'),
      '1' => t('Hide'),
      '2' => t('Manually set'),
    ),
    '#default_value' => isset($settings['hide_page_title']) ? $settings['hide_page_title'] : FALSE,
    '#weight' => 100,
  );
  $contexts = ds_get_entity_context($entity_type);
  $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,
        )),
      );
    }
  }
  $return['page_option_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => isset($settings['page_option_title']) ? $settings['page_option_title'] : '',
    '#description' => t('The title, you may use substitutions in this title.'),
    '#weight' => 101,
    '#states' => array(
      'visible' => array(
        array(
          ':input[name="page_option_type"]' => array(
            'value' => '2',
          ),
        ),
        array(
          ':input[name="additional_settings[ds_page_title_options][page_option_type]"]' => array(
            'value' => '2',
          ),
        ),
      ),
    ),
  );
  $header = array(
    t('Keyword'),
    t('Value'),
  );
  $return['page_option_contexts'] = array(
    '#type' => 'fieldset',
    '#title' => t('Substitutions'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#value' => theme('table', array(
      'header' => $header,
      'rows' => $rows,
    )),
    '#weight' => 102,
    '#states' => array(
      'visible' => array(
        array(
          ':input[name="page_option_type"]' => array(
            'value' => '2',
          ),
        ),
        array(
          ':input[name="additional_settings[ds_page_title_options][page_option_type]"]' => array(
            'value' => '2',
          ),
        ),
      ),
    ),
  );
  return $return;
}