public function LdapAttribute::buildOptionsForm in Lightweight Directory Access Protocol (LDAP) 8.4
Same name and namespace in other branches
- 8.3 ldap_query/src/Plugin/views/field/LdapAttribute.php \Drupal\ldap_query\Plugin\views\field\LdapAttribute::buildOptionsForm()
Default options form that provides the label widget that all fields should have.
Overrides FieldPluginBase::buildOptionsForm
File
- ldap_query/
src/ Plugin/ views/ field/ LdapAttribute.php, line 70
Class
- LdapAttribute
- The handler for loading a specific LDAP field.
Namespace
Drupal\ldap_query\Plugin\views\fieldCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) : void {
$form['multi_value'] = [
'#type' => 'select',
'#title' => $this
->t('Values to show'),
'#description' => $this
->t('What to do with multi-value attributes'),
'#options' => [
'v-all' => $this
->t('All values'),
'v-index' => $this
->t('Show Nth value'),
'v-count' => $this
->t('Count values'),
],
'#default_value' => $this->options['multi_value'],
'#required' => TRUE,
];
$form['value_separator'] = [
'#type' => 'textfield',
'#title' => $this
->t('Value separator'),
'#description' => $this
->t('Separator to use between values in multivalued attributes'),
'#default_value' => $this->options['value_separator'],
'#states' => [
'visible' => [
[
':input[name="options[multi_value]"]' => [
'value' => 'v-all',
],
],
],
],
];
$form['index_value'] = [
'#type' => 'textfield',
'#title' => $this
->t('Index'),
'#description' => $this
->t('Index of the value to show. Use negative numbers to index from last item (0=First, -1=Last)'),
'#default_value' => $this->options['index_value'],
'#states' => [
'visible' => [
[
':input[name="options[multi_value]"]' => [
'value' => 'v-index',
],
],
],
],
];
parent::buildOptionsForm($form, $form_state);
}