You are here

function og_panels_form in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og_panels.module \og_panels_form()
  2. 5.3 og_panels.module \og_panels_form()
  3. 5.7 og_panels.module \og_panels_form()
  4. 6 modules/og_panels/og_panels.module \og_panels_form()

Add/edit an og_panel.

Return value

void

1 string reference to 'og_panels_form'
og_panels_menu in ./og_panels.module

File

./og_panels.module, line 290

Code

function og_panels_form($group_node, $did = NULL) {
  drupal_set_title(check_plain($group_node->title));
  if (!is_null($did)) {
    $display = og_panels_get_one_by_display($did);
  }
  else {
    $display = new stdClass();
  }
  $form['page_title'] = array(
    '#title' => t('Page title'),
    '#type' => 'textfield',
    '#required' => $display->default_page ? FALSE : TRUE,
    '#default_value' => $display->page_title,
    '#description' => t('This is the title of the page and of the tab.'),
    '#size' => 32,
  );
  global $base_url;
  $field_prefix = "{$base_url}/node/{$group_node->nid}/";
  $form[$display->default_page ? 'path_placeholder' : 'path'] = array(
    '#title' => t('Path'),
    '#type' => 'textfield',
    '#default_value' => $display->default_page ? '' : $display->path,
    '#field_prefix' => $field_prefix,
    '#required' => $display->default_page ? FALSE : TRUE,
    '#description' => $display->default_page ? t('This page is currently your default group home page and has no configurable path.') : '',
    '#disabled' => $display->default_page,
    '#size' => 32,
  );
  if ($display->default_page) {
    $form['path'] = array(
      '#type' => 'hidden',
      '#value' => $display->path,
    );
  }
  $form['show_blocks'] = array(
    '#title' => t('Show blocks'),
    '#type' => 'checkbox',
    '#default_value' => isset($display->show_blocks) ? $display->show_blocks : TRUE,
    '#description' => t('If unchecked, the standard group blocks will not be shown unless you place them into your page content. This gives admin more control over page presentation.'),
  );
  $form['published'] = array(
    '#type' => 'checkbox',
    '#title' => t('Published'),
    '#default_value' => $display->published,
    '#description' => t('If unchecked, this page is only accessible by group or site administrators. Thats useful while you are configuring the page.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $did ? t('Update page') : t('Create page'),
  );
  $form['did'] = array(
    '#type' => 'value',
    '#value' => $did,
  );
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $group_node->nid,
  );
  return $form;
}