You are here

function og_panels_table in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og_panels.module \og_panels_table()
  2. 5 og_panels.module \og_panels_table()
  3. 5.3 og_panels.module \og_panels_table()
  4. 5.7 og_panels.module \og_panels_table()

A form for setting the group homepage. Includes a helpful table of Pages and their operations links.

Return value

$form array

1 string reference to 'og_panels_table'
og_panels_overview in modules/og_panels/og_panels.module
Menu callback. List the pages for this specified group. Provide helpful operations links.

File

modules/og_panels/og_panels.module, line 177

Code

function og_panels_table($displays, $group_node) {
  $nid = $group_node->nid;
  $form['#tree'] = TRUE;

  // #tree must be true in order to separate out the entries in the weight field
  foreach ($displays as $display) {
    $item['page_title'] = array(
      '#value' => l($display->page_title, "node/{$nid}/{$display->path}"),
    );
    $item['weight'] = array(
      '#type' => 'weight',
      '#default_value' => $display->weight,
    );
    $item['edit content'] = array(
      '#value' => l(t('Edit content'), "node/{$nid}/og_panels/{$display->did}/panel_content", array(
        'query' => drupal_get_destination(),
      )),
    );
    $item['change layout'] = array(
      '#value' => l(t('Change layout'), "node/{$nid}/og_panels/{$display->did}/panel_layout"),
    );
    $item['edit layout settings'] = array(
      '#value' => l(t('Edit layout settings'), "node/{$nid}/og_panels/{$display->did}/panel_settings"),
    );
    $item['edit page'] = array(
      '#value' => l(t('Edit page'), "node/{$nid}/og_panels/form/{$display->did}", array(
        'query' => drupal_get_destination(),
      )),
    );
    $item['delete page'] = array(
      '#value' => l(t('Delete page'), "node/{$nid}/og_panels/{$display->did}/delete", array(
        'query' => drupal_get_destination(),
      )),
    );
    $form['displays'][$display->did] = $item;

    // Store the default_page for later.
    if ($display->default_page == 1) {
      $default_page = $display->did;
    }

    // Prepare the options for the radios.
    $options[$display->did] = '';
  }
  $form['default_page'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => $default_page,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  $form['group_node'] = array(
    '#type' => 'value',
    '#value' => $group_node,
  );
  return $form;
}