Browse Source

Coding standards

pull/745/head
dannylamb 5 years ago
parent
commit
f8dd584390
  1. 6
      src/IslandoraUtils.php
  2. 9
      src/Plugin/Condition/NodeHasTerm.php

6
src/IslandoraUtils.php

@ -291,6 +291,12 @@ class IslandoraUtils {
return NULL; return NULL;
} }
/**
* Gets every field name that might contain an external uri for a term.
*
* @return string[]
* Field names for fields that a term may have as an external uri.
*/
public function getUriFieldNamesForTerms() { public function getUriFieldNamesForTerms() {
// Get authority link fields to search. // Get authority link fields to search.
$field_map = $this->entityFieldManager->getFieldMap(); $field_map = $this->entityFieldManager->getFieldMap();

9
src/Plugin/Condition/NodeHasTerm.php

@ -123,6 +123,9 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI
return parent::buildConfigurationForm($form, $form_state); return parent::buildConfigurationForm($form, $form_state);
} }
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::validateConfigurationForm($form, $form_state); parent::validateConfigurationForm($form, $form_state);
$value = $form_state->getValue('term'); $value = $form_state->getValue('term');
@ -199,9 +202,9 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI
} }
foreach ($field_names as $field_name) { foreach ($field_names as $field_name) {
if ($entity->hasField($field_name) && !$entity->get($field_name)->isEmpty()) { if ($entity->hasField($field_name) && !$entity->get($field_name)->isEmpty()) {
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
}); });
@ -209,7 +212,7 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI
// Get their URIs. // Get their URIs.
$haystack = array_map(function ($term) { $haystack = array_map(function ($term) {
return $this->utils->getUriForTerm($term); return $this->utils->getUriForTerm($term);
}, },
$terms $terms
); );

Loading…
Cancel
Save