public function Node::buildOptionsForm in Views (for Drupal 7) 8.3
Same name in this branch
- 8.3 lib/Views/node/Plugin/views/argument_validator/Node.php \Views\node\Plugin\views\argument_validator\Node::buildOptionsForm()
- 8.3 lib/Views/node/Plugin/views/field/Node.php \Views\node\Plugin\views\field\Node::buildOptionsForm()
Provide the default form for setting options.
Overrides ArgumentValidatorPluginBase::buildOptionsForm
File
- lib/
Views/ node/ Plugin/ views/ argument_validator/ Node.php, line 35 - Definition of Views\node\Plugin\views\argument_validator\Node.
Class
- Node
- Validate whether an argument is an acceptable node.
Namespace
Views\node\Plugin\views\argument_validatorCode
public function buildOptionsForm(&$form, &$form_state) {
$types = node_type_get_types();
$options = array();
foreach ($types as $type => $info) {
$options[$type] = check_plain(t($info->name));
}
$form['types'] = array(
'#type' => 'checkboxes',
'#title' => t('Content types'),
'#options' => $options,
'#default_value' => $this->options['types'],
'#description' => t('Choose one or more content types to validate with.'),
);
$form['access'] = array(
'#type' => 'checkbox',
'#title' => t('Validate user has access to the content'),
'#default_value' => $this->options['access'],
);
$form['access_op'] = array(
'#type' => 'radios',
'#title' => t('Access operation to check'),
'#options' => array(
'view' => t('View'),
'update' => t('Edit'),
'delete' => t('Delete'),
),
'#default_value' => $this->options['access_op'],
'#states' => array(
'visible' => array(
':input[name="options[validate][options][node][access]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['nid_type'] = array(
'#type' => 'select',
'#title' => t('Filter value format'),
'#options' => array(
'nid' => t('Node ID'),
'nids' => t('Node IDs separated by , or +'),
),
'#default_value' => $this->options['nid_type'],
);
}