diff --git a/cypress/integration/08_admin_views.spec.js b/cypress/integration/08_admin_views.spec.js index 1036332fb9..b183bda58c 100644 --- a/cypress/integration/08_admin_views.spec.js +++ b/cypress/integration/08_admin_views.spec.js @@ -22,7 +22,7 @@ context('Admin content and dataset views', () => { cy.get('#view-field-data-type-table-column > a').should('contain','Data Type'); // There is an "Add new dataset" button that takes user to the dataset json form. cy.get('.view-header > .form-actions > .button').should('contain', 'Add new dataset').click({ force:true }) - cy.contains('h1', 'Create Data'); + cy.contains('h1', 'Create dataset'); }) it('User can create a dataset with the UI.', () => { diff --git a/cypress/integration/09_admin_links.spec.js b/cypress/integration/09_admin_links.spec.js index 4df326c64c..2a64b30c90 100755 --- a/cypress/integration/09_admin_links.spec.js +++ b/cypress/integration/09_admin_links.spec.js @@ -69,7 +69,7 @@ context('Administration pages', () => { cy.contains('h1', 'Datasets'); cy.get('.button').contains('+ Add new dataset').click( { force:true }) - cy.contains('h1', 'Create Data'); + cy.contains('h1', 'Create dataset'); }) it('DKAN menu contains link to create a dataset.', () => { @@ -78,7 +78,7 @@ context('Administration pages', () => { cy.wrap($el).contains('Datasets').parent().within(() => { cy.get('li.menu-item a').contains('Create').click({ force:true }) }) - cy.contains('h1', 'Create Data') + cy.contains('h1', 'Create dataset') }) }) @@ -89,6 +89,7 @@ context('Administration pages', () => { cy.contains('h1', 'DKAN Metastore (Data Dictionaries)'); cy.get('.button').contains('+ Add new data dictionary').click( { force:true }) cy.get('fieldset').contains('Data Dictionary Fields'); + cy.contains('h1', 'Create data-dictionary') }) }) diff --git a/modules/metastore/metastore.module b/modules/metastore/metastore.module index f3bdfba35e..bf3d06ca81 100644 --- a/modules/metastore/metastore.module +++ b/modules/metastore/metastore.module @@ -111,6 +111,10 @@ function metastore_entity_is_valid_item(EntityInterface $entity) { * Implements hook_form_alter(). */ function metastore_form_alter(&$form, FormStateInterface $form_state, $form_id) { + if ($form_id == 'node_data_form') { + $datatype = \Drupal::request()->get('schema') ?? 'dataset'; + $form['#title'] = t('Create @datatype', ['@datatype' => $datatype]); + } $fieldName = \Drupal::service('dkan.metastore.metastore_item_factory')::getMetadataField(); if (isset($form[$fieldName]['widget'][0]['value']['#default_value'])) { $json = $form[$fieldName]['widget'][0]['value']['#default_value'];