You are here

function finder_ui_page in Finder 7.2

Finder UI page.

Parameters

$finder: The finder object.

Return value

The form array.

1 call to finder_ui_page()
finder_ui_form in modules/finder_ui/includes/finder.inc
Form handler callback for finder_ui plugin.

File

modules/finder_ui/includes/finder.inc, line 19

Code

function finder_ui_page($finder) {
  ctools_include('modal');
  ctools_modal_add_js();
  finder_inc('element', 'finder_ui');
  finder_inc('item', 'finder_ui');
  drupal_add_js(drupal_get_path('module', 'finder_ui') . '/finder_ui_reload.js');
  $form['#tree'] = TRUE;
  $form['admin']['#prefix'] = '<div class="finder-ui">';
  $form['admin']['#suffix'] = '</div>';
  $form['admin']['info']['#prefix'] = '<div class="finder-ui-info">';
  $form['admin']['info']['#suffix'] = '</div>';
  $form['admin']['info']['edit']['#prefix'] = '<div class="finder-ui-info-edit">';
  $menu = array(
    'links' => array(
      'edit' => array(
        'title' => t('Edit finder info'),
        'href' => 'admin/structure/finder/list/' . $finder->name . '/edit/info',
      ),
    ),
  );
  $form['admin']['info']['edit']['#markup'] = theme('links__ctools_dropbutton', $menu);
  $form['admin']['info']['edit']['#suffix'] = '</div>';
  $form['admin']['info'] += finder_ui_info($finder);
  $form['admin']['columns']['#prefix'] = '<div class="finder-ui-columns">';
  $form['admin']['columns']['#suffix'] = '</div>';
  $finder_ui = finder_ui($finder);
  $finder_items = array();
  $stripe = 'odd';
  foreach ($finder_ui['items'] as $item_key => $item) {
    $stripe = $stripe == 'odd' ? 'even' : 'odd';
    $finder_items[$item['#group']][$item_key]['#prefix'] = '<div class="finder-ui-item ' . $stripe . '" id="finder-ui-item-' . $item_key . '">';
    $finder_items[$item['#group']][$item_key]['#markup'] = finder_ui_item($finder, $item_key, $item);
    $finder_items[$item['#group']][$item_key]['#suffix'] = '</div>';

    //$finder_items[$item['#group']][$item_key] = $item_output;
  }

  // Elements group is a special case.
  $finder_items['elements']['elements'] = finder_ui_element_list($finder);
  $finder_items['elements']['elements']['#prefix'] = '<div id="finder-ui-elements-list">';
  $finder_items['elements']['elements']['#suffix'] = '</div>';
  foreach (array(
    1,
    2,
    3,
  ) as $column) {
    $form['admin']['columns'][$column]['#prefix'] = '<div class="finder-ui-column" id="finder-ui-column-' . $column . '">';
    $form['admin']['columns'][$column]['#suffix'] = '</div>';
    foreach ($finder_ui['groups'][$column] as $group_key => $group) {
      $extra = '';
      if ($group_key == 'elements') {

        // Elements group is a special case.
        $menu = array(
          'links' => array(
            'edit' => array(
              'title' => t('Add'),
              'href' => 'admin/structure/finder/list/' . $finder->name . '/element/new/nojs',
              'html' => TRUE,
              'attributes' => array(
                'class' => array(
                  'ctools-use-modal',
                  'ctools-modal-finder-modal-style',
                ),
              ),
            ),
          ),
        );
        $extra = theme('links__ctools_dropbutton', $menu);
      }
      $form['admin']['columns'][$column][$group_key]['#prefix'] = '<div class="finder-ui-group" id="finder-ui-group-' . $group_key . '">';
      $form['admin']['columns'][$column][$group_key]['#suffix'] = '</div>';
      $form['admin']['columns'][$column][$group_key]['title']['#prefix'] = '<div class="finder-ui-group-title" id="finder-ui-group-' . $group_key . '-title">';
      $form['admin']['columns'][$column][$group_key]['title']['#markup'] = $extra . '<h3>' . $group . '</h3>';
      $form['admin']['columns'][$column][$group_key]['title']['#suffix'] = '</div>';
      $form['admin']['columns'][$column][$group_key]['items'] = $finder_items[$group_key];
    }
  }
  ctools_object_cache_set('finder', $finder->name, $finder);
  return $form;
}