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", 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..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,http://purl.org/dc/dcmitype/Collection#Model' + uri: 'http://purl.org/dc/dcmitype/Collection' logic: and reactions: blocks: 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/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 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 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..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 @@ -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); @@ -190,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; }