From 20feedc68038efb01b3501c801938595b1fa9349 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 24 Feb 2022 12:08:34 -0400 Subject: [PATCH 01/10] Remove requirement for resource type. --- config/install/context.context.audio.yml | 2 +- .../install/context.context.basic_image.yml | 2 +- config/install/context.context.book.yml | 2 +- config/install/context.context.collection.yml | 2 +- ...context.context.compound_member_object.yml | 2 +- .../context.context.compund_parent_object.yml | 2 +- .../install/context.context.large_image.yml | 2 +- config/install/context.context.newspaper.yml | 2 +- .../context.context.newspaper_child_issue.yml | 2 +- ...e.islandora_object.field_resource_type.yml | 2 +- ...field.storage.node.field_resource_type.yml | 2 +- ...islandora_install_profile_demo_core.module | 44 +++++++------------ 12 files changed, 26 insertions(+), 40 deletions(-) diff --git a/config/install/context.context.audio.yml b/config/install/context.context.audio.yml index 9e271908..7206bee7 100644 --- a/config/install/context.context.audio.yml +++ b/config/install/context.context.audio.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: media: '@islandora.media_route_context_provider:media' - uri: 'http://purl.org/coar/resource_type/c_18cc,http://purl.org/dc/dcmitype/Sound' + uri: 'http://purl.org/coar/resource_type/c_18cc' logic: and reactions: { } weight: -13 diff --git a/config/install/context.context.basic_image.yml b/config/install/context.context.basic_image.yml index 040591d7..2caf74b7 100644 --- a/config/install/context.context.basic_image.yml +++ b/config/install/context.context.basic_image.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: media: '@islandora.media_route_context_provider:media' - uri: 'http://purl.org/coar/resource_type/c_c513,http://purl.org/dc/dcmitype/StillImage' + uri: 'http://purl.org/coar/resource_type/c_c513' logic: and reactions: { } weight: -3 diff --git a/config/install/context.context.book.yml b/config/install/context.context.book.yml index 85c6e28e..91a372bf 100644 --- a/config/install/context.context.book.yml +++ b/config/install/context.context.book.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'https://schema.org/Book,http://purl.org/dc/dcmitype/Collection' + uri: 'https://schema.org/Book' logic: and reactions: view_mode_alter: diff --git a/config/install/context.context.collection.yml b/config/install/context.context.collection.yml index 5db96f3a..f6b3feae 100644 --- a/config/install/context.context.collection.yml +++ b/config/install/context.context.collection.yml @@ -22,7 +22,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'http://purl.org/dc/dcmitype/Collection,http://purl.org/dc/dcmitype/Collection#Model' + uri: 'http://purl.org/dc/dcmitype/Collection#Model' logic: and reactions: blocks: diff --git a/config/install/context.context.compound_member_object.yml b/config/install/context.context.compound_member_object.yml index 51145fdc..57fead2f 100644 --- a/config/install/context.context.compound_member_object.yml +++ b/config/install/context.context.compound_member_object.yml @@ -17,7 +17,7 @@ conditions: parent_reference_field: field_member_of model_uri: 'http://vocab.getty.edu/aat/300242735' logic: and - uri: 'http://purl.org/dc/dcmitype/Collection' + uri: null context_mapping: node: '@node.node_route_context:node' reactions: diff --git a/config/install/context.context.compund_parent_object.yml b/config/install/context.context.compund_parent_object.yml index f27a5715..beafc010 100644 --- a/config/install/context.context.compund_parent_object.yml +++ b/config/install/context.context.compund_parent_object.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'http://purl.org/dc/dcmitype/Collection,http://vocab.getty.edu/aat/300242735' + uri: 'http://vocab.getty.edu/aat/300242735' logic: and reactions: view_mode_alter: diff --git a/config/install/context.context.large_image.yml b/config/install/context.context.large_image.yml index cbc1c613..8f008687 100644 --- a/config/install/context.context.large_image.yml +++ b/config/install/context.context.large_image.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: media: '@islandora.media_route_context_provider:media' - uri: 'http://purl.org/coar/resource_type/c_c513,http://purl.org/dc/dcmitype/StillImage' + uri: 'http://purl.org/coar/resource_type/c_c513' logic: and reactions: { } weight: -12 diff --git a/config/install/context.context.newspaper.yml b/config/install/context.context.newspaper.yml index db2eedee..7e5c4ec3 100644 --- a/config/install/context.context.newspaper.yml +++ b/config/install/context.context.newspaper.yml @@ -18,7 +18,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'http://purl.org/dc/dcmitype/Collection,https://schema.org/Newspaper' + uri: 'https://schema.org/Newspaper' logic: and reactions: blocks: diff --git a/config/install/context.context.newspaper_child_issue.yml b/config/install/context.context.newspaper_child_issue.yml index 7ea301c9..1839b91e 100644 --- a/config/install/context.context.newspaper_child_issue.yml +++ b/config/install/context.context.newspaper_child_issue.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'https://schema.org/PublicationIssue,http://purl.org/dc/dcmitype/Collection' + uri: 'https://schema.org/PublicationIssue' logic: and reactions: view_mode_alter: diff --git a/config/install/field.field.node.islandora_object.field_resource_type.yml b/config/install/field.field.node.islandora_object.field_resource_type.yml index 44bc6123..3522a07f 100644 --- a/config/install/field.field.node.islandora_object.field_resource_type.yml +++ b/config/install/field.field.node.islandora_object.field_resource_type.yml @@ -11,7 +11,7 @@ entity_type: node bundle: islandora_object label: 'Resource Type' description: '' -required: true +required: false translatable: false default_value: { } default_value_callback: '' diff --git a/config/install/field.storage.node.field_resource_type.yml b/config/install/field.storage.node.field_resource_type.yml index 1b777523..88f9f8e7 100644 --- a/config/install/field.storage.node.field_resource_type.yml +++ b/config/install/field.storage.node.field_resource_type.yml @@ -16,7 +16,7 @@ settings: target_type: taxonomy_term module: core locked: false -cardinality: 1 +cardinality: -1 translatable: true indexes: { } persist_with_no_fields: false diff --git a/modules/islandora_install_profile_demo_core/islandora_install_profile_demo_core.module b/modules/islandora_install_profile_demo_core/islandora_install_profile_demo_core.module index 82506a6e..b8a86a20 100644 --- a/modules/islandora_install_profile_demo_core/islandora_install_profile_demo_core.module +++ b/modules/islandora_install_profile_demo_core/islandora_install_profile_demo_core.module @@ -660,18 +660,17 @@ function islandora_install_profile_demo_core_entity_view(array &$build, EntityIn //kpr($context_manager->getActiveContexts()); //\Drupal::messenger()->addStatus($view_mode); // Added to avoid error message. - $empty_field_resource_type = ''; + $empty_field_model = ''; + $nodeModelType = ''; if ($display->getComponent('object_navigation') || ($entity->bundle() === 'extracted_text')) { if ($entity->bundle() != 'extracted_text') { - $empty_field_resource_type = (!empty($entity->get('field_resource_type')->entity)); - if ($empty_field_resource_type) { - $nodeResourceModelType = $entity->get('field_resource_type')->entity->getName(); + $empty_field_model = (!empty($entity->get('field_model')->entity)); + if ($empty_field_model) { $nodeModelType = $entity->get('field_model')->entity->getName(); $immediate_parent_id = ($entity->hasField('field_member_of') && $entity->field_member_of instanceof Drupal\node\Entity\Node) ? $entity->get('field_member_of')->entity->id() : FALSE; } } else { // Manually override for the OCR page. - $nodeResourceModelType = "Text"; $nodeModelType = "OCR"; if (isset($parentNode) && $parentNode->hasField('field_member_of')) { $grandparent = $parentNode->get('field_member_of')->first(); @@ -697,7 +696,7 @@ function islandora_install_profile_demo_core_entity_view(array &$build, EntityIn $url_object = Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' => $entity->id()], $options); // $displays = ['Full View', 'Pages', 'Page', 'OCR']; - if ($empty_field_resource_type || ($entity->bundle() === 'extracted_text')) { + if ($empty_field_model || ($entity->bundle() === 'extracted_text')) { $build['object_navigation'] = [ '#theme' => 'islandora_object_links', '#links' => [ ] @@ -705,9 +704,9 @@ function islandora_install_profile_demo_core_entity_view(array &$build, EntityIn // This relies on there being a display media for each of these. // Admin > Structure > Views > Display media // The view uses the Taxonomy > islandora_media_use's PCDM URI to assign a page. - switch ("{$nodeModelType}_{$nodeResourceModelType}") { + switch ($nodeModelType) { // PDF - case 'Digital Document_Text'; + case 'Digital Document'; if ($ocrExist) { $parent_url = Url::fromRoute('entity.node.canonical', ['node' => $immediate_parent_id], ['absolute' => TRUE]); $build['object_navigation']['#links']['parent']['label'] = t('Full View'); @@ -719,13 +718,13 @@ function islandora_install_profile_demo_core_entity_view(array &$build, EntityIn } break; // Newspaper - case 'Newspaper_Collection': + case 'Newspaper': break; - case 'Publication Issue_Collection': - case 'Paged Content_Interactive Resource': - case 'Paged Content_Collection': - case 'Book_Collection': - case 'Content_Interactive Resource': + case 'Publication Issue': + case 'Paged Content': + case 'Paged Content': + case 'Book': + case 'Content': // Current Page, no need for it to be a link $parent_url = Url::fromRoute('entity.node.canonical', ['node' => $immediate_parent_id], ['absolute' => TRUE]); $build['object_navigation']['#links']['parent']['label'] = t('Full View'); @@ -735,7 +734,7 @@ function islandora_install_profile_demo_core_entity_view(array &$build, EntityIn $build['object_navigation']['#links']['pages']['label'] = t('Pages'); $build['object_navigation']['#links']['pages']['attributes'] = new Attribute(['class' => ['horizontal-tab-button'] ]); break; - case 'OCR_Text': + case 'OCR': $build['object_navigation']['#links']['parent']['url'] = $immediate_parent_id; $build['object_navigation']['#links']['parent']['label'] = t('Full View'); $build['object_navigation']['#links']['parent']['attributes'] = new Attribute(['class' => ['horizontal-tab-button']]); @@ -755,9 +754,7 @@ function islandora_install_profile_demo_core_entity_view(array &$build, EntityIn $build['object_navigation']['#links']['ocr']['attributes'] = new Attribute(['class' => ['selected', 'horizontal-tab-button']]); $build['object_navigation']['#links']['ocr']['label'] = t('OCR'); break; - case 'Page_Text': - case 'Page_Still Image': - case 'Page_Image': + case 'Page': if ($immediate_parent_id) { $parent_url = Url::fromRoute('entity.node.canonical', ['node' => $immediate_parent_id], ['absolute' => TRUE]); $build['object_navigation']['#links']['parent']['url'] = $parent_url; @@ -831,17 +828,6 @@ function islandora_install_profile_demo_core_module_implements_alter(&$implement } } -/** - * Implements hook_preprocess_HOOK(). - */ -function islandora_install_profile_demo_core_preprocess_node(&$variables) { - $node = \Drupal::routeMatch()->getParameter('node'); - if ($node instanceof \Drupal\node\NodeInterface && $node->hasField('field_resource_type')) { - - } -} - - /** * Implements hook_views_pre_view(). * Make sure we overwrite certain views to get information on the parent object to properly display members From f300f4b97401457584ec14f7a829421592dbb90b Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Wed, 3 Aug 2022 19:46:44 -0400 Subject: [PATCH 02/10] Update NodeHasExplicitParent.php Removing resource type from implicit parent taxonomy uri lookup --- .../Plugin/Condition/NodeHasExplicitParent.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php b/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php index dcc99a19..9ad71cbe 100644 --- a/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php +++ b/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php @@ -124,21 +124,6 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#description' => t("Machine name of field that contains references to parent node."), ]; - $form['term_resource_type'] = [ - '#type' => 'entity_autocomplete', - '#title' => $this->t('Select Parent taxonomy term(s) reference with URI (resource type)'), - '#description' => $this->t('Only terms that have external URIs/URLs will appear here.'), - '#tags' => TRUE, - '#default_value' => $uri_default, - '#target_type' => 'taxonomy_term', - '#required' => FALSE, - '#selection_handler' => 'islandora:external_uri', - '#selection_settings' => [ - 'target_bundles' => array('resource_types'), - ], - - ]; - $form['term_model'] = array( '#type' => 'entity_autocomplete', @@ -161,7 +146,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { // Set URI for term if possible. - $defaults = ['uri' => "term_resource_type", 'model_uri' => 'term_model']; + $defaults = ['model_uri' => 'term_model']; foreach ($defaults as $field => $result_variable) { $this->configuration[$field] = NULL; $value = $form_state->getValue($result_variable); From 32411ee36b451cae6c55a2d850fb50d23ef6ebd6 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Wed, 3 Aug 2022 19:51:55 -0400 Subject: [PATCH 03/10] Incorrect URL --- config/install/context.context.video.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/install/context.context.video.yml b/config/install/context.context.video.yml index e83eb3aa..60a3087f 100644 --- a/config/install/context.context.video.yml +++ b/config/install/context.context.video.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'https://github.com/Islandora/Crayfish/tree/dev/Homarus' + uri: 'http://purl.org/coar/resource_type/c_12ce' logic: and reactions: view_mode_alter: From 222ad791f1b88dd4f866fa65ce6660f3a61c7109 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Thu, 4 Aug 2022 10:31:06 -0400 Subject: [PATCH 04/10] Missing display term for remote video --- migrate/tags.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/migrate/tags.csv b/migrate/tags.csv index ef9a4abf..3b2c71b3 100644 --- a/migrate/tags.csv +++ b/migrate/tags.csv @@ -19,6 +19,7 @@ islandora_models,"Compound Object","A special type of collection where the paren islandora_models,"Newspaper","A special type of collection which only has Newspaper Issues for children.",https://schema.org/Newspaper islandora_display,"Open Seadragon","Display using the Open Seadragon viewer",http://openseadragon.github.io islandora_display,"PDFjs","Display using the PDF.js viewer",http://mozilla.github.io/pdf.js +islandora_display,"Remote Video","Displays video from another site",https://github.com/Islandora/Crayfish/tree/dev/Homarus resource_types,"Collection","An aggregation of resources",http://purl.org/dc/dcmitype/Collection resource_types,"Dataset","Data encoded in a defined structure",http://purl.org/dc/dcmitype/Dataset resource_types,"Image","A visual representation other than text",http://purl.org/dc/dcmitype/Image From b509064f2a1f633331bc4468cabb0f97dc2de4b2 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Thu, 4 Aug 2022 10:32:15 -0400 Subject: [PATCH 05/10] As it turns out, this was correct and there was a missing term --- config/install/context.context.video.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/install/context.context.video.yml b/config/install/context.context.video.yml index 60a3087f..e83eb3aa 100644 --- a/config/install/context.context.video.yml +++ b/config/install/context.context.video.yml @@ -15,7 +15,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'http://purl.org/coar/resource_type/c_12ce' + uri: 'https://github.com/Islandora/Crayfish/tree/dev/Homarus' logic: and reactions: view_mode_alter: From 513d9267322b62dde0f4a160ecf812fd38427bcd Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Thu, 4 Aug 2022 10:33:36 -0400 Subject: [PATCH 06/10] I removed the form field for this, so no need for a null value --- config/install/context.context.compound_member_object.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config/install/context.context.compound_member_object.yml b/config/install/context.context.compound_member_object.yml index 57fead2f..d2994b67 100644 --- a/config/install/context.context.compound_member_object.yml +++ b/config/install/context.context.compound_member_object.yml @@ -17,7 +17,6 @@ conditions: parent_reference_field: field_member_of model_uri: 'http://vocab.getty.edu/aat/300242735' logic: and - uri: null context_mapping: node: '@node.node_route_context:node' reactions: From 89d540fad386cd1694954f8db02a23918e185cd6 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Thu, 4 Aug 2022 10:33:59 -0400 Subject: [PATCH 07/10] Correct value doesn't have #Model --- config/install/context.context.collection.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/install/context.context.collection.yml b/config/install/context.context.collection.yml index f6b3feae..588d2e2c 100644 --- a/config/install/context.context.collection.yml +++ b/config/install/context.context.collection.yml @@ -22,7 +22,7 @@ conditions: negate: false context_mapping: node: '@node.node_route_context:node' - uri: 'http://purl.org/dc/dcmitype/Collection#Model' + uri: 'http://purl.org/dc/dcmitype/Collection' logic: and reactions: blocks: From ce2c19f34560a39d01cd23ea995dfb5391a96c39 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Thu, 4 Aug 2022 12:57:00 -0400 Subject: [PATCH 08/10] Validation edit- blank uri caused "always success" --- .../src/Plugin/Condition/NodeHasExplicitParent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php b/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php index 9ad71cbe..3a819170 100644 --- a/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php +++ b/modules/islandora_install_profile_demo_core/src/Plugin/Condition/NodeHasExplicitParent.php @@ -175,7 +175,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s */ public function evaluate() { $entity = $this->getContextValue('node'); - if ((empty($this->configuration['uri']) && !$this->isNegated()) || (empty($this->configuration['model_uri']) && !$this->isNegated())) { + if ((empty($this->configuration['model_uri']) && !$this->isNegated())) { return TRUE; } From 8b0953314bf48b583141da7f97a6c6f1f48ff7e5 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Tue, 9 Aug 2022 12:54:53 -0300 Subject: [PATCH 09/10] Fix incomplete condition? --- config/install/context.context.compound_member_object.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/install/context.context.compound_member_object.yml b/config/install/context.context.compound_member_object.yml index d2994b67..51145fdc 100644 --- a/config/install/context.context.compound_member_object.yml +++ b/config/install/context.context.compound_member_object.yml @@ -17,6 +17,7 @@ conditions: parent_reference_field: field_member_of model_uri: 'http://vocab.getty.edu/aat/300242735' logic: and + uri: 'http://purl.org/dc/dcmitype/Collection' context_mapping: node: '@node.node_route_context:node' reactions: From 616bf911d4528ee5f3ceb778b0a7fbb2362ce5bb Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Tue, 23 Aug 2022 15:19:00 -0400 Subject: [PATCH 10/10] There's a bug in ctools > 4.0 that prevents builds right now --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 7bcb0b6d..3e5780fc 100644 --- a/composer.json +++ b/composer.json @@ -100,6 +100,7 @@ "drupal/config_update": "^1.7", "drupal/console": "dev-master", "drupal/context": "4.x-dev#14c362a5c57457692cdb1335c24619e6ae76af94", + "drupal/ctools": "4.0.0", "drupal/devel": "^4.1", "drupal/ds": "^3.13", "drupal/environment_indicator": "^4.0",