diff --git a/core/profiles/demo_umami/config/install/block_content.type.disclaimer_block.yml b/core/profiles/demo_umami/config/install/block_content.type.disclaimer_block.yml new file mode 100644 index 00000000000..d4e08a36e43 --- /dev/null +++ b/core/profiles/demo_umami/config/install/block_content.type.disclaimer_block.yml @@ -0,0 +1,7 @@ +langcode: en +status: true +dependencies: { } +id: disclaimer_block +label: 'Disclaimer block' +revision: 0 +description: 'A disclaimer block contains disclaimer and copyright text.' diff --git a/core/profiles/demo_umami/config/install/block_content.type.footer_promo_block.yml b/core/profiles/demo_umami/config/install/block_content.type.footer_promo_block.yml new file mode 100644 index 00000000000..3c4df974806 --- /dev/null +++ b/core/profiles/demo_umami/config/install/block_content.type.footer_promo_block.yml @@ -0,0 +1,7 @@ +langcode: en +status: true +dependencies: { } +id: footer_promo_block +label: 'Footer promo block' +revision: 0 +description: 'A footer promo block contains a title, promo text, and a "find out more" link.' diff --git a/core/profiles/demo_umami/config/install/core.entity_form_display.block_content.disclaimer_block.default.yml b/core/profiles/demo_umami/config/install/core.entity_form_display.block_content.disclaimer_block.default.yml new file mode 100644 index 00000000000..a64f7c28057 --- /dev/null +++ b/core/profiles/demo_umami/config/install/core.entity_form_display.block_content.disclaimer_block.default.yml @@ -0,0 +1,39 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.disclaimer_block + - field.field.block_content.disclaimer_block.field_copyright + - field.field.block_content.disclaimer_block.field_disclaimer + module: + - text +id: block_content.disclaimer_block.default +targetEntityType: block_content +bundle: disclaimer_block +mode: default +content: + field_copyright: + weight: 28 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: text_textarea + region: content + field_disclaimer: + weight: 27 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: text_textarea + region: content + info: + type: string_textfield + weight: -5 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: { } diff --git a/core/profiles/demo_umami/config/install/core.entity_form_display.block_content.footer_promo_block.default.yml b/core/profiles/demo_umami/config/install/core.entity_form_display.block_content.footer_promo_block.default.yml new file mode 100644 index 00000000000..7e826f0928b --- /dev/null +++ b/core/profiles/demo_umami/config/install/core.entity_form_display.block_content.footer_promo_block.default.yml @@ -0,0 +1,48 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.footer_promo_block + - field.field.block_content.footer_promo_block.field_content_link + - field.field.block_content.footer_promo_block.field_summary + - field.field.block_content.footer_promo_block.field_title + module: + - link +id: block_content.footer_promo_block.default +targetEntityType: block_content +bundle: footer_promo_block +mode: default +content: + field_content_link: + weight: 3 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_summary: + weight: 2 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: string_textarea + region: content + field_title: + weight: 1 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + info: + type: string_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: { } diff --git a/core/profiles/demo_umami/config/install/core.entity_view_display.block_content.disclaimer_block.default.yml b/core/profiles/demo_umami/config/install/core.entity_view_display.block_content.disclaimer_block.default.yml new file mode 100644 index 00000000000..6e8808c4de8 --- /dev/null +++ b/core/profiles/demo_umami/config/install/core.entity_view_display.block_content.disclaimer_block.default.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.disclaimer_block + - field.field.block_content.disclaimer_block.field_copyright + - field.field.block_content.disclaimer_block.field_disclaimer + module: + - text +id: block_content.disclaimer_block.default +targetEntityType: block_content +bundle: disclaimer_block +mode: default +content: + field_copyright: + weight: 2 + label: hidden + settings: { } + third_party_settings: { } + type: text_default + region: content + field_disclaimer: + weight: 1 + label: hidden + settings: { } + third_party_settings: { } + type: text_default + region: content +hidden: { } diff --git a/core/profiles/demo_umami/config/install/core.entity_view_display.block_content.footer_promo_block.default.yml b/core/profiles/demo_umami/config/install/core.entity_view_display.block_content.footer_promo_block.default.yml new file mode 100644 index 00000000000..550399cba06 --- /dev/null +++ b/core/profiles/demo_umami/config/install/core.entity_view_display.block_content.footer_promo_block.default.yml @@ -0,0 +1,43 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.footer_promo_block + - field.field.block_content.footer_promo_block.field_content_link + - field.field.block_content.footer_promo_block.field_summary + - field.field.block_content.footer_promo_block.field_title + module: + - link +id: block_content.footer_promo_block.default +targetEntityType: block_content +bundle: footer_promo_block +mode: default +content: + field_content_link: + weight: 2 + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_summary: + weight: 1 + label: hidden + settings: { } + third_party_settings: { } + type: basic_string + region: content + field_title: + weight: 0 + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: { } diff --git a/core/profiles/demo_umami/config/install/field.field.block_content.disclaimer_block.field_copyright.yml b/core/profiles/demo_umami/config/install/field.field.block_content.disclaimer_block.field_copyright.yml new file mode 100644 index 00000000000..964a88887cf --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.field.block_content.disclaimer_block.field_copyright.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.disclaimer_block + - field.storage.block_content.field_copyright + module: + - text +id: block_content.disclaimer_block.field_copyright +field_name: field_copyright +entity_type: block_content +bundle: disclaimer_block +label: Copyright +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: text_long diff --git a/core/profiles/demo_umami/config/install/field.field.block_content.disclaimer_block.field_disclaimer.yml b/core/profiles/demo_umami/config/install/field.field.block_content.disclaimer_block.field_disclaimer.yml new file mode 100644 index 00000000000..d2d3c918508 --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.field.block_content.disclaimer_block.field_disclaimer.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.disclaimer_block + - field.storage.block_content.field_disclaimer + module: + - text +id: block_content.disclaimer_block.field_disclaimer +field_name: field_disclaimer +entity_type: block_content +bundle: disclaimer_block +label: Disclaimer +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: text_long diff --git a/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_content_link.yml b/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_content_link.yml new file mode 100644 index 00000000000..06e5a850f46 --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_content_link.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.footer_promo_block + - field.storage.block_content.field_content_link + module: + - link +id: block_content.footer_promo_block.field_content_link +field_name: field_content_link +entity_type: block_content +bundle: footer_promo_block +label: 'Find out more link' +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + link_type: 17 + title: 2 +field_type: link diff --git a/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_summary.yml b/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_summary.yml new file mode 100644 index 00000000000..9a6f240c063 --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_summary.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.footer_promo_block + - field.storage.block_content.field_summary +id: block_content.footer_promo_block.field_summary +field_name: field_summary +entity_type: block_content +bundle: footer_promo_block +label: 'Promo text' +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_title.yml b/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_title.yml new file mode 100644 index 00000000000..0d51c80bc97 --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.field.block_content.footer_promo_block.field_title.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - block_content.type.footer_promo_block + - field.storage.block_content.field_title +id: block_content.footer_promo_block.field_title +field_name: field_title +entity_type: block_content +bundle: footer_promo_block +label: 'Promo title' +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/core/profiles/demo_umami/config/install/field.storage.block_content.field_copyright.yml b/core/profiles/demo_umami/config/install/field.storage.block_content.field_copyright.yml new file mode 100644 index 00000000000..4f87da17d9a --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.storage.block_content.field_copyright.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + module: + - block_content + - text +id: block_content.field_copyright +field_name: field_copyright +entity_type: block_content +type: text_long +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/core/profiles/demo_umami/config/install/field.storage.block_content.field_disclaimer.yml b/core/profiles/demo_umami/config/install/field.storage.block_content.field_disclaimer.yml new file mode 100644 index 00000000000..85202e28560 --- /dev/null +++ b/core/profiles/demo_umami/config/install/field.storage.block_content.field_disclaimer.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + module: + - block_content + - text +id: block_content.field_disclaimer +field_name: field_disclaimer +entity_type: block_content +type: text_long +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/core/profiles/demo_umami/config/optional/block.block.umami_disclaimer.yml b/core/profiles/demo_umami/config/optional/block.block.umami_disclaimer.yml index 747a287e321..178024cdf4b 100644 --- a/core/profiles/demo_umami/config/optional/block.block.umami_disclaimer.yml +++ b/core/profiles/demo_umami/config/optional/block.block.umami_disclaimer.yml @@ -1,8 +1,13 @@ langcode: en status: true dependencies: + content: + - 'block_content:disclaimer_block:9b4dcd67-99f3-48d0-93c9-2c46648b29de' + enforced: + module: + - demo_umami_content module: - - demo_umami + - block_content theme: - umami id: umami_disclaimer @@ -10,16 +15,13 @@ theme: umami region: bottom weight: 10 provider: null -plugin: umami_disclaimer +plugin: 'block_content:9b4dcd67-99f3-48d0-93c9-2c46648b29de' settings: - id: umami_disclaimer + id: 'block_content:9b4dcd67-99f3-48d0-93c9-2c46648b29de' label: 'Umami disclaimer' - provider: demo_umami + provider: block_content label_display: '0' - umami_disclaimer: - value: 'Umami Magazine & Umami Publications is a fictional magazine and publisher for illustrative purposes only.' - format: basic_html - umami_copyright: - value: '© 2018 Terms & Conditions' - format: basic_html + status: true + info: '' + view_mode: full visibility: { } diff --git a/core/profiles/demo_umami/config/optional/block.block.umami_footer_promo.yml b/core/profiles/demo_umami/config/optional/block.block.umami_footer_promo.yml index a85ebdb98d5..1e8b82b2b3f 100644 --- a/core/profiles/demo_umami/config/optional/block.block.umami_footer_promo.yml +++ b/core/profiles/demo_umami/config/optional/block.block.umami_footer_promo.yml @@ -1,8 +1,13 @@ langcode: en status: true dependencies: + content: + - 'block_content:footer_promo_block:924ab293-8f5f-45a1-9c7f-2423ae61a241' + enforced: + module: + - demo_umami_content module: - - demo_umami + - block_content theme: - umami id: umami_footer_promo @@ -10,14 +15,13 @@ theme: umami region: footer weight: -1 provider: null -plugin: umami_footer_promo +plugin: 'block_content:924ab293-8f5f-45a1-9c7f-2423ae61a241' settings: - id: umami_footer_promo - label: 'Umami Footer promo' - provider: demo_umami + id: 'block_content:924ab293-8f5f-45a1-9c7f-2423ae61a241' + label: 'Umami footer promo' + provider: block_content label_display: '0' - promo_title: 'Umami Food Magazine' - promo_text: 'Skills and know-how. Magazine exclusive articles, recipes and plenty of reasons to get your copy today.' - findmore_url: '/about-umami' - findmore_text: 'Find out more' + status: true + info: '' + view_mode: full visibility: { } diff --git a/core/profiles/demo_umami/config/schema/demo_umami.schema.yml b/core/profiles/demo_umami/config/schema/demo_umami.schema.yml deleted file mode 100644 index 7ccb017dc0e..00000000000 --- a/core/profiles/demo_umami/config/schema/demo_umami.schema.yml +++ /dev/null @@ -1,27 +0,0 @@ -block.settings.umami_disclaimer: - type: block_settings - label: 'Disclaimer block' - mapping: - umami_disclaimer: - type: text_format - label: 'Disclaimer' - umami_copyright: - type: text_format - label: 'Copyright' - -block.settings.umami_footer_promo: - type: block_settings - label: 'Footer promo block' - mapping: - promo_title: - type: string - label: 'Promo title' - promo_text: - type: string - label: 'Promo text' - findmore_url: - type: string - label: 'Find more URL' - findmore_text: - type: string - label: 'Find more text' diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index 73b0484cd38..cf91059414c 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -313,6 +313,38 @@ class InstallHelper implements ContainerInjectionInterface { 'alt' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings', ], ], + 'umami_disclaimer' => [ + 'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de', + 'info' => 'Umami disclaimer', + 'type' => 'disclaimer_block', + 'field_disclaimer' => [ + 'value' => 'Umami Magazine & Umami Publications is a fictional magazine and publisher for illustrative purposes only.', + 'format' => 'basic_html', + ], + 'field_copyright' => [ + 'value' => '© 2018 Terms & Conditions', + 'format' => 'basic_html', + ], + ], + 'umami_footer_promo' => [ + 'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241', + 'info' => 'Umami footer promo', + 'type' => 'footer_promo_block', + 'field_title' => [ + 'value' => 'Umami Food Magazine', + ], + 'field_summary' => [ + 'value' => 'Skills and know-how. Magazine exclusive articles, recipes and plenty of reasons to get your copy today.', + ], + 'field_content_link' => [ + 'uri' => 'internal:' . call_user_func(function () { + $nodes = $this->entityTypeManager->getStorage('node')->loadByProperties(['title' => 'About Umami']); + $node = reset($nodes); + return $this->aliasManager->getAliasByPath('/node/' . $node->id()); + }), + 'title' => 'Find out more', + ], + ], ]; // Create block content. diff --git a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php index 2c9129c56ba..ef955bca301 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php @@ -45,12 +45,15 @@ class UninstallDefaultContentTest extends BrowserTestBase { $node_storage->resetCache(); // Assert the removal of blocks on uninstall. - $count = $block_storage->getQuery() - ->condition('type', 'banner_block') - ->count() - ->execute(); - $this->assertEquals(0, $count); - $this->assertNull($this->container->get('entity_type.manager')->getStorage('block')->load('umami_banner_recipes')); + foreach ($this->expectedBlocks() as $block_info) { + $count = $block_storage->getQuery() + ->condition('type', $block_info['type']) + ->count() + ->execute(); + $this->assertEquals(0, $count); + $block = $block_storage->loadByProperties(['uuid' => $block_info['uuid']]); + $this->assertCount(0, $block); + } // Assert the removal of nodes on uninstall. $count = $node_storage->getQuery() @@ -95,20 +98,49 @@ class UninstallDefaultContentTest extends BrowserTestBase { * Block storage. */ protected function assertImportedCustomBlock(EntityStorageInterface $block_storage) { - // Verify that block is placed. $assert = $this->assertSession(); $this->drupalGet('/recipes'); - $assert->pageTextContains('Super easy vegetarian pasta bake'); - $img_alt_text = $assert->elementExists('css', '#block-umami-banner-recipes img')->getAttribute('alt'); - $this->assertEquals('Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings', $img_alt_text); + foreach ($this->expectedBlocks() as $block_info) { + // Verify that the block is placed. + $assert->pageTextContains($block_info['unique_text']); + // For the banner block, also verify the presence of alt text on the + // banner image. + if ($block_info['type'] == 'banner_block') { + $img_alt_text = $assert->elementExists('css', '#block-umami-banner-recipes img')->getAttribute('alt'); + $this->assertEquals('Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings', $img_alt_text); + } + // Verify that the block can be loaded. + $count = $block_storage->getQuery() + ->condition('type', $block_info['type']) + ->count() + ->execute(); + $this->assertGreaterThan(0, $count); + $block = $block_storage->loadByProperties(['uuid' => $block_info['uuid']]); + $this->assertCount(1, $block); + } + } - $count = $block_storage->getQuery() - ->condition('type', 'banner_block') - ->count() - ->execute(); - $this->assertGreaterThan(0, $count); - $block = $block_storage->loadByProperties(['uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541']); - $this->assertCount(1, $block); + /** + * Returns the expected properties of this profile's custom blocks. + */ + protected function expectedBlocks() { + return [ + [ + 'type' => 'banner_block', + 'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541', + 'unique_text' => 'A wholesome pasta bake is the ultimate comfort food.', + ], + [ + 'type' => 'disclaimer_block', + 'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de', + 'unique_text' => 'is a fictional magazine and publisher for illustrative purposes only', + ], + [ + 'type' => 'footer_promo_block', + 'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241', + 'unique_text' => 'Magazine exclusive articles, recipes and plenty of reasons to get your copy today.', + ], + ]; } } diff --git a/core/profiles/demo_umami/src/Plugin/Block/UmamiDisclaimer.php b/core/profiles/demo_umami/src/Plugin/Block/UmamiDisclaimer.php deleted file mode 100644 index 3ecd3aa4eac..00000000000 --- a/core/profiles/demo_umami/src/Plugin/Block/UmamiDisclaimer.php +++ /dev/null @@ -1,88 +0,0 @@ - FALSE, - 'umami_disclaimer' => [ - 'value' => '', - 'format' => '', - ], - 'umami_copyright' => [ - 'value' => '', - 'format' => '', - ], - ] + parent::defaultConfiguration(); - } - - /** - * {@inheritdoc} - */ - public function build() { - $disclaimer_markup = check_markup($this->configuration['umami_disclaimer']['value'], $this->configuration['umami_disclaimer']['format']); - $copyright_markup = check_markup($this->configuration['umami_copyright']['value'], $this->configuration['umami_copyright']['format']); - - return [ - '#type' => 'inline_template', - '#template' => '{{ disclaimer }}{{ copyright }}', - '#context' => [ - 'disclaimer' => $disclaimer_markup, - 'copyright' => $copyright_markup, - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function blockForm($form, FormStateInterface $form_state) { - $form = parent::blockForm($form, $form_state); - - $form['umami_disclaimer'] = [ - '#type' => 'text_format', - '#title' => $this->t('Umami Disclaimer'), - '#default_value' => $this->configuration['umami_disclaimer']['value'], - '#format' => $this->configuration['umami_disclaimer']['format'], - ]; - - $form['umami_copyright'] = [ - '#type' => 'text_format', - '#title' => $this->t('Umami Copyright Text'), - '#default_value' => $this->configuration['umami_copyright']['value'], - '#format' => $this->configuration['umami_copyright']['format'], - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function blockSubmit($form, FormStateInterface $form_state) { - parent::blockSubmit($form, $form_state); - - $this->configuration['umami_disclaimer'] = $form_state->getValue('umami_disclaimer'); - $this->configuration['umami_copyright'] = $form_state->getValue('umami_copyright'); - } - -} diff --git a/core/profiles/demo_umami/src/Plugin/Block/UmamiFooterPromo.php b/core/profiles/demo_umami/src/Plugin/Block/UmamiFooterPromo.php deleted file mode 100644 index 8ae90dccde9..00000000000 --- a/core/profiles/demo_umami/src/Plugin/Block/UmamiFooterPromo.php +++ /dev/null @@ -1,104 +0,0 @@ - FALSE, - 'promo_title' => '', - 'promo_text' => '', - 'findmore_url' => '', - 'findmore_text' => '', - ] + parent::defaultConfiguration(); - } - - /** - * {@inheritdoc} - */ - public function build() { - return [ - '#type' => 'inline_template', - '#template' => '', - '#context' => [ - 'promo_title' => $this->configuration['promo_title'], - 'promo_text' => $this->configuration['promo_text'], - 'findmore_url' => $this->configuration['findmore_url'], - 'findmore_text' => $this->configuration['findmore_text'], - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function blockForm($form, FormStateInterface $form_state) { - $form = parent::blockForm($form, $form_state); - - $form['promo_title'] = [ - '#type' => 'textfield', - '#title' => $this->t('Promo Title'), - '#default_value' => $this->configuration['promo_title'], - ]; - - $form['promo_text'] = [ - '#type' => 'textarea', - '#title' => $this->t('Promo Text'), - '#default_value' => $this->configuration['promo_text'], - ]; - - $form['findmore'] = [ - '#type' => 'fieldset', - '#title' => $this->t('Find more'), - ]; - - $form['findmore']['url'] = [ - '#type' => 'path', - '#convert_path' => PathElement::CONVERT_NONE, - '#validate_path' => FALSE, - '#title' => $this->t('URL'), - '#default_value' => $this->configuration['findmore_url'], - '#description' => $this->t('Enter an relative or absolute url. Eg: /about-umami or https://www.drupal.org'), - ]; - - $form['findmore']['text'] = [ - '#type' => 'textfield', - '#title' => $this->t('Text'), - '#default_value' => $this->configuration['findmore_text'], - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function blockSubmit($form, FormStateInterface $form_state) { - parent::blockSubmit($form, $form_state); - - $this->configuration['promo_title'] = $form_state->getValue('promo_title'); - $this->configuration['promo_text'] = $form_state->getValue('promo_text'); - $this->configuration['findmore_url'] = $form_state->getValue(['findmore', 'url']); - $this->configuration['findmore_text'] = $form_state->getValue(['findmore', 'text']); - } - -} diff --git a/core/profiles/demo_umami/themes/umami/css/components/blocks/banner/banner.css b/core/profiles/demo_umami/themes/umami/css/components/blocks/banner/banner.css index f807f41d9e3..19039c847e0 100644 --- a/core/profiles/demo_umami/themes/umami/css/components/blocks/banner/banner.css +++ b/core/profiles/demo_umami/themes/umami/css/components/blocks/banner/banner.css @@ -3,26 +3,26 @@ * This file is used to style the banner block. */ -.block-banner-block { +.block-type-banner-block { background-size: 0 0; } -.block-banner-block .summary { +.block-type-banner-block .summary { margin: 1em; } -.block-banner-block .field--name-field-title { +.block-type-banner-block .field--name-field-title { font-family: 'Scope One', Georgia, serif; font-size: 1.424rem; font-weight: 400; margin: 0 0 1.07em 0; } -.block-banner-block .field--name-field-summary { +.block-type-banner-block .field--name-field-summary { margin-bottom: 1.28em; } -.block-banner-block .field--name-field-content-link a { +.block-type-banner-block .field--name-field-content-link a { display: inline-block; padding: 0.5em 1.5em 0.4em; border: 0; @@ -39,8 +39,8 @@ transition: background-color 0.5s ease; } -.block-banner-block .field--name-field-content-link a:focus, -.block-banner-block .field--name-field-content-link a:hover { +.block-type-banner-block .field--name-field-content-link a:focus, +.block-type-banner-block .field--name-field-content-link a:hover { background-color: #00836d; color: #fff; text-decoration: underline; @@ -48,7 +48,7 @@ /* 768px */ @media screen and (min-width: 48rem) { /* 768px */ - .block-banner-block { + .block-type-banner-block { background-color: #464646; background-size: cover; background-position: left center; @@ -56,7 +56,7 @@ /* Image ratio 7:3 */ } - .block-banner-block .block-inner { + .block-type-banner-block .block-inner { max-width: 1200px; margin: 0 auto; display: flex; @@ -65,13 +65,13 @@ align-items: center; } - .block-banner-block .summary { + .block-type-banner-block .summary { margin: 0; flex: 0 0 30%; color: #ffffff; } - .block-banner-block .field--name-field-banner-image { + .block-type-banner-block .field--name-field-banner-image { display: none; } } diff --git a/core/profiles/demo_umami/themes/umami/css/components/blocks/disclaimer/disclaimer.css b/core/profiles/demo_umami/themes/umami/css/components/blocks/disclaimer/disclaimer.css new file mode 100644 index 00000000000..6c7096f6071 --- /dev/null +++ b/core/profiles/demo_umami/themes/umami/css/components/blocks/disclaimer/disclaimer.css @@ -0,0 +1,31 @@ +/** + * @file + * This file is used to style the disclaimer block. + */ + +.block-type-disclaimer-block .field--name-field-disclaimer, +.block-type-disclaimer-block .field--name-field-copyright { + display: block; + text-align: center; + font-size: 0.94rem; +} + +@media screen and (min-width: 75rem) { + .block-type-disclaimer-block .field--name-field-disclaimer, + .block-type-disclaimer-block .field--name-field-copyright { + margin-bottom: 0; + } + + .block-type-disclaimer-block .field--name-field-disclaimer { + float: left; + max-width: 40%; + text-align: left; + margin-left: 0.5rem; + } + + .block-type-disclaimer-block .field--name-field-copyright { + float: right; + width: 25%; + text-align: left; + } +} diff --git a/core/profiles/demo_umami/themes/umami/css/components/blocks/footer-promo/footer-promo.css b/core/profiles/demo_umami/themes/umami/css/components/blocks/footer-promo/footer-promo.css index 394c139e210..4b0153f75ee 100644 --- a/core/profiles/demo_umami/themes/umami/css/components/blocks/footer-promo/footer-promo.css +++ b/core/profiles/demo_umami/themes/umami/css/components/blocks/footer-promo/footer-promo.css @@ -3,17 +3,21 @@ * This file is used to style the Footer promo block. */ -.footer-promo { +.block-type-footer-promo-block { padding-top: 250px; background: url('../../../../images/png/umami-bundle.png') no-repeat center top; } -.footer-promo__title { +.block-type-footer-promo-block .block__title { font-size: 1.5rem; font-weight: normal; } -.footer-promo__text a { +.block-type-footer-promo-block .footer-promo-content { + margin-bottom: 1.28rem; +} + +.block-type-footer-promo-block .footer-promo-content a { background-color: inherit; clear: left; display: block; @@ -22,14 +26,14 @@ text-decoration: none; } -.footer-promo__text a:active, -.footer-promo__text a:focus, -.footer-promo__text a:hover { +.block-type-footer-promo-block .footer-promo-content a:active, +.block-type-footer-promo-block .footer-promo-content a:focus, +.block-type-footer-promo-block .footer-promo-content a:hover { background-color: transparent; text-decoration: underline; } -.footer-promo__text a:after { +.block-type-footer-promo-block .footer-promo-content a:after { display: inline-block; width: 14px; height: 14px; @@ -39,7 +43,7 @@ } @media screen and (min-width: 60rem) { - .footer-promo { + .block-type-footer-promo-block { flex-basis: 60%; height: 200px; padding-top: 0; @@ -48,7 +52,7 @@ font-size: 0.9rem; } - .footer-promo__title { + .block-type-footer-promo-block .block__title { padding-top: 2rem; } } diff --git a/core/profiles/demo_umami/themes/umami/css/components/regions/bottom/bottom.css b/core/profiles/demo_umami/themes/umami/css/components/regions/bottom/bottom.css index 19ca321db7a..5a23585907d 100644 --- a/core/profiles/demo_umami/themes/umami/css/components/regions/bottom/bottom.css +++ b/core/profiles/demo_umami/themes/umami/css/components/regions/bottom/bottom.css @@ -9,34 +9,8 @@ overflow: hidden; } -.umami-disclaimer, -.umami-copyright { - display: block; - text-align: center; - margin-bottom: 1rem; - font-size: 0.94rem; -} - @media screen and (min-width: 75rem) { .layout-bottom { padding: 3rem 0; } - - .umami-disclaimer, - .umami-copyright { - margin-bottom: 0; - } - - .umami-disclaimer { - float: left; - max-width: 40%; - text-align: left; - margin-left: 0.5rem; - } - - .umami-copyright { - float: right; - width: 25%; - text-align: left; - } } diff --git a/core/profiles/demo_umami/themes/umami/templates/components/banner-block/block--bundle--banner-block.html.twig b/core/profiles/demo_umami/themes/umami/templates/components/banner-block/block--bundle--banner-block.html.twig index be5ebcb93e6..20eea680ad0 100644 --- a/core/profiles/demo_umami/themes/umami/templates/components/banner-block/block--bundle--banner-block.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/components/banner-block/block--bundle--banner-block.html.twig @@ -30,7 +30,6 @@ 'block', 'block-' ~ configuration.provider|clean_class, 'block-' ~ plugin_id|clean_class, - 'block-banner-block', 'cover-image', ] %} diff --git a/core/profiles/demo_umami/themes/umami/templates/components/footer-promo-block/block--bundle--footer-promo-block.html.twig b/core/profiles/demo_umami/themes/umami/templates/components/footer-promo-block/block--bundle--footer-promo-block.html.twig new file mode 100644 index 00000000000..43d9a0cae71 --- /dev/null +++ b/core/profiles/demo_umami/themes/umami/templates/components/footer-promo-block/block--bundle--footer-promo-block.html.twig @@ -0,0 +1,45 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% elseif content.field_title %} + {{ content.field_title }} + {% endif %} + {{ title_suffix }} + {% block content %} + + {% endblock %} + diff --git a/core/profiles/demo_umami/themes/umami/templates/components/footer/block--umami-footer-promo.html.twig b/core/profiles/demo_umami/themes/umami/templates/components/footer/block--umami-footer-promo.html.twig deleted file mode 100644 index 884298f9f5a..00000000000 --- a/core/profiles/demo_umami/themes/umami/templates/components/footer/block--umami-footer-promo.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "block.html.twig" %} -{# -/** - * @file - * Theme override for Umami footer Promo block. - */ -#} -{% set attributes = attributes.addClass('footer-promo') %} diff --git a/core/profiles/demo_umami/themes/umami/umami.libraries.yml b/core/profiles/demo_umami/themes/umami/umami.libraries.yml index c4379fb593e..b0afce0db95 100644 --- a/core/profiles/demo_umami/themes/umami/umami.libraries.yml +++ b/core/profiles/demo_umami/themes/umami/umami.libraries.yml @@ -5,6 +5,7 @@ global: css/base.css: {} css/components/blocks/banner/banner.css: {} css/components/blocks/branding/branding.css: {} + css/components/blocks/disclaimer/disclaimer.css: {} css/components/blocks/page-title/page-title.css: {} css/components/blocks/footer-promo/footer-promo.css: {} css/components/blocks/search/search.css: {} diff --git a/core/profiles/demo_umami/themes/umami/umami.theme b/core/profiles/demo_umami/themes/umami/umami.theme index 4f744eaa658..d8b61ff5152 100644 --- a/core/profiles/demo_umami/themes/umami/umami.theme +++ b/core/profiles/demo_umami/themes/umami/umami.theme @@ -5,6 +5,7 @@ * Functions to support theming in the Umami theme. */ +use Drupal\Component\Utility\Html; use Drupal\Core\Form\FormStateInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; @@ -45,6 +46,10 @@ function umami_preprocess_field(&$variables, $hook) { */ function umami_preprocess_block(&$variables) { $variables['title_attributes']['class'][] = 'block__title'; + // Add a class indicating the custom block bundle. + if (isset($variables['elements']['content']['#block_content'])) { + $variables['attributes']['class'][] = Html::getClass('block-type-' . $variables['elements']['content']['#block_content']->bundle()); + } } /**