You are here

function _popup_ui_form_formatters_form in Popup 7

Same name and namespace in other branches
  1. 8 modules/popup_ui/includes/popup_ui.admin.inc \_popup_ui_form_formatters_form()
1 call to _popup_ui_form_formatters_form()
popup_ui_form_formatters in modules/popup_ui/includes/popup_ui.admin.inc

File

modules/popup_ui/includes/popup_ui.admin.inc, line 127

Code

function _popup_ui_form_formatters_form($key, $values, $options) {
  module_load_include('inc', 'popup_ui', 'includes/popup_ui.api');
  module_load_include('inc', 'popup', 'includes/popup.util');
  static $weight = 0;
  $values += _popup_defaults();
  $form = $key == 'new' ? array(
    'fieldset' => array(
      '#group' => 'popup_formats',
      '#title' => 'Add a new new format',
      '#type' => 'fieldset',
      '#weight' => -1,
    ),
  ) : array(
    'fieldset' => array(
      '#group' => 'popup_formats',
      '#title' => $values['label'],
      '#type' => 'fieldset',
      '#weight' => $weight++,
    ),
  );
  $form['fieldset']['fields'] = array(
    'ops' => array(
      '#markup' => $key == 'new' ? ' ' : popup_ui_confirm('Delete', 'Are you sure you want to delete this popup format? It cannot be undone!', 'admin/config/user-interface/popup/formats/delete/' . $key, array(
        'origin' => 'bottom-right',
        'expand' => 'bottom-left',
      )),
    ),
    'label' => array(
      '#default_value' => $values['label'],
      '#size' => 20,
      '#title' => 'Administrative label',
      '#type' => 'textfield',
      '#description' => 'To be used on administrative pages. End users will not see this label.',
    ),
    array(
      '#markup' => '<div class="column meta-column">',
    ),
    array(
      '#markup' => '<div class="section section-display"><div class="section-inner"><h4>' . t('Display') . '</h4>',
    ),
    'origin' => array(
      '#default_value' => isset($values['origin']) ? $values['origin'] : FALSE,
      '#title' => 'Origin',
      '#type' => 'select',
      '#options' => $options['position'],
      '#description' => 'Corner from where the popup should originate.',
    ),
    'expand' => array(
      '#default_value' => $values['expand'],
      '#title' => 'Expand',
      '#type' => 'select',
      '#options' => $options['position'],
      '#description' => 'Direction in which the popup should expand.',
    ),
    'effect' => array(
      '#default_value' => $values['effect'],
      '#title' => 'Effect',
      '#type' => 'select',
      '#options' => $options['effect'],
      '#description' => 'Effect used to display the popup.',
    ),
    'style' => array(
      '#default_value' => $values['style'],
      '#title' => 'Style',
      '#type' => 'select',
      '#options' => $options['style'],
      '#description' => 'Visual style with which to display the popup.',
    ),
    'opacity' => array(
      '#default_value' => $values['opacity'],
      '#title' => 'Opacity',
      '#type' => 'select',
      '#options' => $options['opacity'],
    ),
    'width' => array(
      '#default_value' => $values['width'],
      '#title' => 'Width',
      '#type' => 'select',
      '#options' => $options['width'],
    ),
    array(
      '#markup' => '</div></div><div class="section section-behavior"><div class="section-inner"><h4>' . t('Behavior') . '</h4>',
    ),
    'activate' => array(
      '#default_value' => $values['activate'],
      '#title' => 'Activation',
      '#type' => 'select',
      '#options' => array(
        'hover' => t('Hover'),
        'click' => t('Click'),
      ),
    ),
    'close' => array(
      '#default_value' => $values['close'],
      '#title' => 'Display a close button',
      '#type' => 'checkbox',
    ),
    'ajax' => array(
      '#default_value' => $values['ajax'],
      '#title' => 'Use AJAX to retrieve popup content',
      '#type' => 'checkbox',
    ),
    array(
      '#markup' => '</div></div></div><div class="column content-column">',
    ),
    array(
      '#markup' => '<div class="section section-node"><div class="section-inner"><h4>' . t('Nodes') . '</h4>',
    ),
    'teaser' => array(
      '#default_value' => $values['teaser'],
      '#title' => 'Display nodes as teasers',
      '#type' => 'checkbox',
    ),
    array(
      '#markup' => '</div></div><div class="section section-menu"><div class="section-inner"><h4>' . t('Menus') . '</h4>',
    ),
    'inline' => array(
      '#default_value' => $values['inline'],
      '#title' => 'Render the popup menu element inline within the box model',
      '#type' => 'checkbox',
    ),
    'flat' => array(
      '#default_value' => $values['flat'],
      '#title' => 'Render the top level menu items as a list of popups',
      '#type' => 'checkbox',
    ),
    array(
      '#markup' => '<h4>' . t('Submenus') . '</h4>',
    ),
    'submenu-origin' => array(
      '#default_value' => $values['submenu-origin'],
      '#title' => 'Origin',
      '#type' => 'select',
      '#options' => $options['position'],
    ),
    'submenu-expand' => array(
      '#default_value' => $values['submenu-expand'],
      '#title' => 'Expand',
      '#type' => 'select',
      '#options' => $options['position'],
    ),
    array(
      '#markup' => '</div></div></div>',
    ),
  );
  return $form;
}