function flag_plugin_argument_validate_flaggability::options_form in Flag 7.3
Same name and namespace in other branches
- 6.2 includes/flag_plugin_argument_validate_flaggability.inc \flag_plugin_argument_validate_flaggability::options_form()
- 7.2 includes/flag_plugin_argument_validate_flaggability.inc \flag_plugin_argument_validate_flaggability::options_form()
Provide the default form for setting options.
Overrides views_plugin_argument_validate::options_form
File
- includes/
views/ flag_plugin_argument_validate_flaggability.inc, line 28 - 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) {
// If there are no flag relationships set, skip this form of validation.
$flags = flag_get_flags($this->flag_type);
if (!$flags) {
return array();
}
$options = $this
->flags_options();
$form['flag_name'] = array(
'#type' => 'radios',
'#title' => t('Flag'),
'#options' => $options,
'#default_value' => $this->options['flag_name'],
'#description' => t('Select the flag to validate against.'),
);
if (!$options) {
$form['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' => FLAG_ADMIN_PATH,
)) . '</p>';
}
$form['flag_test'] = array(
'#type' => 'select',
'#title' => t('Validate the @type only if', array(
'@type' => $this->flag_type,
)),
'#options' => $this
->tests_options(),
'#default_value' => $this->options['flag_test'],
);
// 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['flag_id_type'] = array(
'#type' => 'select',
'#title' => t('Argument type'),
'#options' => array(
'id' => t('ID'),
'ids' => t('IDs separated by , or +'),
),
'#default_value' => $this->options['flag_id_type'],
);
}