Browse Source

turn textfield into a select

pull/880/head
Seth Shaw 3 years ago
parent
commit
a90630d976
  1. 12
      src/Plugin/views/filter/NodeHasMediaUse.php

12
src/Plugin/views/filter/NodeHasMediaUse.php

@ -43,9 +43,17 @@ class NodeHasMediaUse extends FilterPluginBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function valueForm(&$form, FormStateInterface $form_state) { protected function valueForm(&$form, FormStateInterface $form_state) {
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['vid' => 'islandora_media_use']);
$uris = [];
foreach ($terms as $term) {
$uri = reset($term->get('field_external_uri')->getValue());
$uris[$uri['uri']] = $term->label();
}
$form['use_uri'] = [ $form['use_uri'] = [
'#type' => 'textfield', '#type' => 'select',
'#title' => "Media Use URI", '#title' => "Media Use Term",
'#options' => $uris,
'#default_value' => $this->options['use_uri'], '#default_value' => $this->options['use_uri'],
'#required' => TRUE, '#required' => TRUE,
]; ];

Loading…
Cancel
Save