diff --git a/src/IslandoraUtils.php b/src/IslandoraUtils.php index e78dd972..931e20d3 100644 --- a/src/IslandoraUtils.php +++ b/src/IslandoraUtils.php @@ -291,6 +291,12 @@ class IslandoraUtils { 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() { // Get authority link fields to search. $field_map = $this->entityFieldManager->getFieldMap(); diff --git a/src/Plugin/Condition/NodeHasTerm.php b/src/Plugin/Condition/NodeHasTerm.php index 41d20676..22f87761 100644 --- a/src/Plugin/Condition/NodeHasTerm.php +++ b/src/Plugin/Condition/NodeHasTerm.php @@ -123,6 +123,9 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI return parent::buildConfigurationForm($form, $form_state); } + /** + * {@inheritdoc} + */ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { parent::validateConfigurationForm($form, $form_state); $value = $form_state->getValue('term'); @@ -199,9 +202,9 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI } 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 FALSE; }); @@ -209,7 +212,7 @@ class NodeHasTerm extends ConditionPluginBase implements ContainerFactoryPluginI // Get their URIs. $haystack = array_map(function ($term) { return $this->utils->getUriForTerm($term); - }, + }, $terms );