Skip to content

Commit

Permalink
remove ability to expose form; todo: bring back some day
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-shaw-unlv committed Jun 10, 2022
1 parent 3526310 commit 39c7b31
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/Plugin/views/filter/NodeHasMediaUse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,16 @@ class NodeHasMediaUse extends FilterPluginBase {
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();

$options['use_uri'] = ['default' => NULL];
$options['negated'] = ['default' => FALSE];

return $options;
return [
'use_uri' => ['default' => NULL],
'negated' => ['default' => FALSE],
];
}

/**
* {@inheritdoc}
*/
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);

$uri = $form_state->getValues()['options']['use_uri'];
$term = \Drupal::service('islandora.utils')->getTermForUri($uri);
if (empty($term)) {
Expand All @@ -42,12 +38,13 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
protected function valueForm(&$form, FormStateInterface $form_state) {
public function buildOptionsForm(&$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();
foreach ($term->get('field_external_uri')->getValue() as $uri) {
$uris[$uri['uri']] = $term->label();
}
}

$form['use_uri'] = [
Expand Down Expand Up @@ -92,7 +89,6 @@ public function query() {
$sub_query->fields('of', ['field_media_of_target_id'])
->condition('use.field_media_use_target_id', $term->id());
$this->query->addWhere(0, 'nid', $sub_query, $condition);

}

}

0 comments on commit 39c7b31

Please sign in to comment.