You are here

function theme_popup_ui_form_formatters in Popup 7.x

Same name and namespace in other branches
  1. 6.x modules/popup_ui/popup_ui.module \theme_popup_ui_form_formatters()

Implementation of theme_popup_ui_form_formatters Themes the formats settings form

File

modules/popup_ui/includes/popup_ui.theme.inc, line 9

Code

function theme_popup_ui_form_formatters($variables) {
  $output = '';
  $form = $variables['form'];
  $rows = array();
  $header = array(
    t('Administrative label'),
    array(
      'data' => '<div>' . t('Display') . '</div>' . t('Origin at'),
      'class' => 'column-section',
    ),
    t('Expand to'),
    t('Effect'),
    t('Style'),
    t('Opacity'),
    t('Width'),
    array(
      'data' => '<div>' . t('Behavior') . '</div>' . t('Activate'),
      'class' => 'column-section',
    ),
    t('Close'),
    t('AJAX'),
    array(
      'data' => '<div>' . t('Node') . '</div>' . t('Teaser'),
      'class' => 'column-section',
    ),
    t('Page'),
    t('Links'),
    t('Panel'),
    array(
      'data' => '<div>' . t('Menu') . '</div>' . t('Inline'),
      'class' => 'column-section',
    ),
    t('Flat'),
    array(
      'data' => '<div>' . t('Submenus') . '</div>' . t('Origin'),
      'class' => 'column-section',
    ),
    t('Expand'),
    array(
      'data' => '',
      'class' => 'column-section',
    ),
  );
  $table_rows = array();
  foreach ($form['rows'] as $row_id => $row) {
    if (substr($row_id, 0, 1) != '#') {
      foreach ($row as $field_id => $field) {
        if (substr($field_id, 0, 1) != '#') {
          if ($field_id == 'origin' || $field_id == 'teaser' || $field_id == 'activate' || $field_id == 'inline' || $field_id == 'submenu-origin' || $field_id == 'ops') {
            $table_rows[$row_id][$field_id] = array(
              'data' => drupal_render($form['rows'][$row_id][$field_id]),
              'class' => 'section',
            );
          }
          else {
            $table_rows[$row_id][$field_id] = drupal_render($form['rows'][$row_id][$field_id]);
          }
        }
      }
    }
  }
  array_unshift($form, array(
    '#markup' => '<div class="form-item">' . '<div class="table-wrapper">' . theme('table', array(
      'attributes' => array(
        'id' => 'format-table',
        'class' => array(
          'popup-settings-table',
        ),
      ),
      'header' => $header,
      'rows' => $table_rows,
    )) . '</div>' . '</div>',
  ));
  $output .= drupal_render_children($form);
  return $output;
}