function views_plugin_argument_validate_field_extractor::options_form in Views Arguments Extras 7
Provide the default form for setting options.
Overrides views_plugin_argument_validate::options_form
File
- ./
views_arguments_extras_plugin_argument_validate_field.inc, line 22 - Contains the php code argument validator plugin.
Class
- views_plugin_argument_validate_field_extractor
- Provide PHP code to validate whether or not an argument is ok.
Code
function options_form(&$form, &$form_state) {
$entity_infos = entity_get_info();
foreach ($entity_infos as $key => $info) {
$entity_options[$key] = $info['label'];
}
$form['entity_type'] = array(
'#title' => 'Entity Type',
'#type' => 'select',
'#options' => $entity_options,
'#default_value' => $this->options['entity_type'],
);
module_load_include("inc", "views_arguments_extras", "views_arguments_extras.field_plugins");
$options = views_arguments_extras_get_plugin_options();
$form['field'] = array(
'#title' => 'Field',
'#type' => 'select',
'#options' => $options,
'#default_value' => $this->options['field'],
'#ajax' => array(
'callback' => 'views_plugin_argument_validator_field_field_callback',
'wrapper' => 'field-settings-wrapper',
'method' => 'replace',
'effect' => 'fade',
),
);
$form['settings'] = array(
'#title' => "Settings",
'#type' => 'fieldset',
'#prefix' => '<div class="field-settings-wrapper">',
'#suffix' => '</div>',
);
if ($this->options['field']) {
$plugins = views_plugin_argument_default_field();
list($p_id, $field) = explode("::", $this->options['field']);
$plugin = $plugins[$p_id];
$form['settings']['#title'] = "Settings for {$plugin['name']}";
if ($form_fun = ctools_plugin_get_function($plugin, "form callback")) {
$plugin_form = $form_fun();
foreach ($plugin_form as $id => $form_element) {
$form['settings'][$id] = $form_element;
$form['settings'][$id]['#default_value'] = $this->options['settings'][$id];
}
}
}
}