You are here

function flag_plugin_argument_validate_flaggability::options_form in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/views/flag_plugin_argument_validate_flaggability.inc \flag_plugin_argument_validate_flaggability::options_form()
  2. 7.2 includes/flag_plugin_argument_validate_flaggability.inc \flag_plugin_argument_validate_flaggability::options_form()
1 call to flag_plugin_argument_validate_flaggability::options_form()
flag_plugin_argument_validate_flaggability::validate_form in includes/flag_plugin_argument_validate_flaggability.inc

File

includes/flag_plugin_argument_validate_flaggability.inc, line 40
Contains the flaggability validator handler.

Class

flag_plugin_argument_validate_flaggability
Validates whether an argument is a flaggable/flagged object.

Code

function options_form(&$form, &$form_state) {
  $options = $this
    ->flags_options();
  $form[$this
    ->_option_name('flag_name')] = array(
    '#type' => 'radios',
    '#title' => t('Flag'),
    '#options' => $options,
    '#default_value' => $this
      ->_get_option('flag_name', '*relationship*'),
    '#description' => t('Select the flag to validate against.'),
  );
  if (!$options) {
    $form[$this
      ->_option_name('flag_name')]['#description'] = '<p class="warning">' . t('No %type flags exist. You must first <a href="@create-url">create a %type flag</a> before being able to use one.', array(
      '%type' => $this->flag_type,
      '@create-url' => 'admin/build/flags',
    )) . '</p>';
  }
  $form[$this
    ->_option_name('flag_test')] = array(
    '#type' => 'select',
    '#title' => t('Validate the @type only if', array(
      '@type' => $this->flag_type,
    )),
    '#options' => $this
      ->tests_options(),
    '#default_value' => $this
      ->_get_option('flag_test', 'flaggable'),
  );

  // This validator supports the "multiple IDs" syntax. It may not be
  // extremely useful, but similar validators do support this and it's a good
  // thing to be compatible.
  $form[$this
    ->_option_name('flag_id_type')] = array(
    '#type' => 'select',
    '#title' => t('Argument type'),
    '#options' => array(
      'id' => t('ID'),
      'ids' => t('IDs separated by , or +'),
    ),
    '#default_value' => $this
      ->_get_option('flag_id_type', 'id'),
  );
}