Loading core/modules/text/js/text.js +6 −3 Changes for core/modules/text/js/text.js: 6 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -41,9 +41,7 @@ // Set up the edit/hide summary link. const $link = $( `<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${Drupal.t( 'Hide summary', )}</button>)</span>`, Drupal.theme('textEditSummaryButton', Drupal.t('Hide summary')), ); const $button = $link.find('button'); let toggleClick = true; Loading @@ -70,4 +68,9 @@ }); }, }; $.extend(Drupal.theme, { textEditSummaryButton(title) { return `<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${title}</button>)</span>`; }, }); })(jQuery, Drupal); core/modules/text/tests/modules/text_summary_test/js/text-summary-override.js 0 → 100644 +12 −0 Changes for core/modules/text/tests/modules/text_summary_test/js/text-summary-override.js: 12 added lines, 0 removed lines. Original line number Diff line number Diff line (function (Drupal) { Drupal.theme.textEditSummaryButton = function (title) { // Add an extra class for testing. return ` <span class="field-edit-link text-test-edit-link"> (<button type="button" class="link link-edit-summary"> <span class="visually-hidden">Custom override: </span>${title} </button>) </span> `; }; })(Drupal); core/modules/text/tests/modules/text_summary_test/src/Hook/TextSummaryTestHooks.php 0 → 100644 +25 −0 Changes for core/modules/text/tests/modules/text_summary_test/src/Hook/TextSummaryTestHooks.php: 25 added lines, 0 removed lines. Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Drupal\text_summary_test\Hook; use Drupal\Core\Hook\Attribute\Hook; use Drupal\Core\State\StateInterface; /** * Hook implementations for text_summary_test. */ class TextSummaryTestHooks { public function __construct(protected readonly StateInterface $state) {} /** * Implements hook_page_attachments_alter(). */ #[Hook('page_attachments_alter')] public function pageAttachmentsAlter(array &$attachments) : void { $attachments['#attached']['library'][] = 'text_summary_test/text-summary-override'; } } core/modules/text/tests/modules/text_summary_test/text_summary_test.info.yml 0 → 100644 +7 −0 Changes for core/modules/text/tests/modules/text_summary_test/text_summary_test.info.yml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line name: 'Text summary test' type: module description: 'Provides test hook implementations for text summary tests' package: Testing version: VERSION dependencies: - drupal:text core/modules/text/tests/modules/text_summary_test/text_summary_test.libraries.yml 0 → 100644 +7 −0 Changes for core/modules/text/tests/modules/text_summary_test/text_summary_test.libraries.yml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line text-summary-override: js: js/text-summary-override.js: {} dependencies: - core/drupal - core/jquery - core/drupal.text Loading
core/modules/text/js/text.js +6 −3 Changes for core/modules/text/js/text.js: 6 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -41,9 +41,7 @@ // Set up the edit/hide summary link. const $link = $( `<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${Drupal.t( 'Hide summary', )}</button>)</span>`, Drupal.theme('textEditSummaryButton', Drupal.t('Hide summary')), ); const $button = $link.find('button'); let toggleClick = true; Loading @@ -70,4 +68,9 @@ }); }, }; $.extend(Drupal.theme, { textEditSummaryButton(title) { return `<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${title}</button>)</span>`; }, }); })(jQuery, Drupal);
core/modules/text/tests/modules/text_summary_test/js/text-summary-override.js 0 → 100644 +12 −0 Changes for core/modules/text/tests/modules/text_summary_test/js/text-summary-override.js: 12 added lines, 0 removed lines. Original line number Diff line number Diff line (function (Drupal) { Drupal.theme.textEditSummaryButton = function (title) { // Add an extra class for testing. return ` <span class="field-edit-link text-test-edit-link"> (<button type="button" class="link link-edit-summary"> <span class="visually-hidden">Custom override: </span>${title} </button>) </span> `; }; })(Drupal);
core/modules/text/tests/modules/text_summary_test/src/Hook/TextSummaryTestHooks.php 0 → 100644 +25 −0 Changes for core/modules/text/tests/modules/text_summary_test/src/Hook/TextSummaryTestHooks.php: 25 added lines, 0 removed lines. Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Drupal\text_summary_test\Hook; use Drupal\Core\Hook\Attribute\Hook; use Drupal\Core\State\StateInterface; /** * Hook implementations for text_summary_test. */ class TextSummaryTestHooks { public function __construct(protected readonly StateInterface $state) {} /** * Implements hook_page_attachments_alter(). */ #[Hook('page_attachments_alter')] public function pageAttachmentsAlter(array &$attachments) : void { $attachments['#attached']['library'][] = 'text_summary_test/text-summary-override'; } }
core/modules/text/tests/modules/text_summary_test/text_summary_test.info.yml 0 → 100644 +7 −0 Changes for core/modules/text/tests/modules/text_summary_test/text_summary_test.info.yml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line name: 'Text summary test' type: module description: 'Provides test hook implementations for text summary tests' package: Testing version: VERSION dependencies: - drupal:text
core/modules/text/tests/modules/text_summary_test/text_summary_test.libraries.yml 0 → 100644 +7 −0 Changes for core/modules/text/tests/modules/text_summary_test/text_summary_test.libraries.yml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line text-summary-override: js: js/text-summary-override.js: {} dependencies: - core/drupal - core/jquery - core/drupal.text