You are here

function spaces_handler_field_node::options_form in Spaces 7.3

Same name and namespace in other branches
  1. 6.3 includes/spaces_handler_field_node.inc \spaces_handler_field_node::options_form()
  2. 7 includes/spaces_handler_field_node.inc \spaces_handler_field_node::options_form()

Override of options_form().

Overrides views_handler_field_node::options_form

File

includes/spaces_handler_field_node.inc, line 19

Class

spaces_handler_field_node

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // @TODO: atm this assumes a pattern of spaces_{$type} for the PURL
  // provider corresponding to each space type. Fixing this requires some
  // serious overhaul of the explicit connection (read: there is none
  // currently) between a space type and its PURL provider.
  $types = array();
  foreach (spaces_types() as $type => $info) {
    if (strpos('node/%node', $info['path']) === 0) {
      $types["spaces_{$type}"] = $info['title'];
    }
  }
  if (!empty($types)) {
    $form['spaces']['#tree'] = TRUE;
    $form['spaces']['frontpage'] = array(
      '#title' => t('Link to space frontpage'),
      '#description' => t('Link a group node to its frontpage instead of its node page.'),
      '#type' => 'checkbox',
      '#default_value' => !empty($this->options['spaces']['frontpage']),
      '#process' => array(
        'ctools_dependent_process',
      ),
      '#dependency' => array(
        'edit-options-link-to-node' => array(
          1,
        ),
      ),
    );
    $form['spaces']['type'] = array(
      '#title' => t('Space type'),
      '#type' => 'select',
      '#options' => $types,
      '#default_value' => !empty($this->options['spaces']['type']),
      '#process' => array(
        'ctools_dependent_process',
      ),
      '#dependency' => array(
        'edit-options-spaces-frontpage' => array(
          1,
        ),
      ),
    );
  }
}