diff --git a/core/modules/node/node.post_update.php b/core/modules/node/node.post_update.php index b0db7f19..3b3c153b 100644 --- a/core/modules/node/node.post_update.php +++ b/core/modules/node/node.post_update.php @@ -7,6 +7,7 @@ use Drupal\Core\Field\Entity\BaseFieldOverride; use Drupal\views\Entity\View; +use Symfony\Component\Yaml\Yaml; /** * Implements hook_removed_post_updates(). @@ -71,3 +72,27 @@ function node_post_update_modify_base_field_author_override() { $base_field_override->setDefaultValueCallback('Drupal\node\Entity\Node::getDefaultEntityOwner')->save(); } } + +/** + * Update promote option for all existing content type. + */ +function node_post_update_base_field_promote_override() { + $config_path = \Drupal::service('extension.list.profile')->getPath('standard') . '/config/install/core.base_field_override.node.page.promote.yml'; + $data = Yaml::parse(file_get_contents($config_path)); + \Drupal::configFactory()->getEditable('core.base_field_override.node.page.promote')->setData($data)->save(TRUE); +} + +/** + * Update promote option for listing page and view. + */ +function node_post_update_action() { + $config_path = \Drupal::service('extension.list.module')->getPath('node') . '/config/install/system.action.node_unpromote_action.yml'; + $data = Yaml::parse(file_get_contents($config_path)); + \Drupal::configFactory()->getEditable('system.action.node_unpromote_action.yml')->setData($data)->save(TRUE); + $config_path = \Drupal::service('extension.list.module')->getPath('node') . '/config/install/system.action.node_promote_action.yml'; + $data = Yaml::parse(file_get_contents($config_path)); + \Drupal::configFactory()->getEditable('system.action.node_promote_action.yml')->setData($data)->save(TRUE); + $config_path = \Drupal::service('extension.list.module')->getPath('node') . '/config/optional/views.view.frontpage.yml'; + $data = Yaml::parse(file_get_contents($config_path)); + \Drupal::configFactory()->getEditable('views.view.frontpage.yml')->setData($data)->save(TRUE); +} diff --git a/core/themes/classy/templates/content/node.html.twig b/core/themes/classy/templates/content/node.html.twig index d2bf8bec..87ed2e3c 100644 --- a/core/themes/classy/templates/content/node.html.twig +++ b/core/themes/classy/templates/content/node.html.twig @@ -38,7 +38,7 @@ * teaser would result in: "node--view-mode-teaser", and * full: "node--view-mode-full". * The following are controlled through the node publishing options. - * - node--promoted: Appears on nodes promoted to the front page. + * - node--promoted: Appears on promoted nodes. * - node--sticky: Appears on nodes ordered above other non-sticky nodes in * teaser listings. * - node--unpublished: Appears on unpublished nodes visible only to site diff --git a/core/themes/seven/templates/classy/content/node.html.twig b/core/themes/seven/templates/classy/content/node.html.twig index eedfd86d..74e9a924 100644 --- a/core/themes/seven/templates/classy/content/node.html.twig +++ b/core/themes/seven/templates/classy/content/node.html.twig @@ -38,7 +38,7 @@ * teaser would result in: "node--view-mode-teaser", and * full: "node--view-mode-full". * The following are controlled through the node publishing options. - * - node--promoted: Appears on nodes promoted to the front page. + * - node--promoted: Appears on promoted nodes. * - node--sticky: Appears on nodes ordered above other non-sticky nodes in * teaser listings. * - node--unpublished: Appears on unpublished nodes visible only to site diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ConfirmClassyCopiesTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ConfirmClassyCopiesTest.php index 1091cf0e..c2c10e7e 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ConfirmClassyCopiesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ConfirmClassyCopiesTest.php @@ -789,7 +789,7 @@ protected function getClassyHash($type, $file) { 'toolbar.html.twig' => '151657ffe8fc7c8f0d9571a8b0684294', 'menu-local-tasks.html.twig' => '1e0112bb83f6073f6fc44a94b43dd74b', 'comment.html.twig' => '271cebfb1c64860e0e392df3a6787ca2', - 'node.html.twig' => '68ce2322607c5a258bd64cb78f49b0e0', + 'node.html.twig' => '4b89b1864a06e43925566707d8095d69', 'taxonomy-term.html.twig' => '63e39620cd877c85297914fef61930de', 'media-embed-error.html.twig' => '83621141a91e525cd4df15c1d93b58b2', 'book-node-export-html.html.twig' => 'e3f896d5f4f69c28256807fb57382eb5', diff --git a/core/modules/book/config/optional/core.base_field_override.node.book.promote.yml b/core/modules/book/config/optional/core.base_field_override.node.book.promote.yml index 79e2ed67..c6c8e040 100644 --- a/core/modules/book/config/optional/core.base_field_override.node.book.promote.yml +++ b/core/modules/book/config/optional/core.base_field_override.node.book.promote.yml @@ -7,8 +7,8 @@ id: node.book.promote field_name: promote entity_type: node bundle: book -label: 'Promoted to front page' -description: '' +label: 'Promote' +description: 'A boolean indicating whether the node should be marked as promoted.' required: false translatable: true default_value: diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index 42d54b21..6861e122 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -602,7 +602,7 @@ public function testSourceAndTargetLanguage() { public function testViewsTranslationUI() { $this->drupalLogin($this->adminUser); - $description = 'All content promoted to the front page.'; + $description = 'All promoted content.'; $human_readable_name = 'Frontpage'; $display_settings_default = 'Default'; $display_options_default = '(Empty)'; diff --git a/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php index fced38d1..0b2a895a 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php @@ -48,7 +48,7 @@ public function testFileFieldRSSContent() { ]; $this->submitForm($edit, 'Save'); - // Create a new node with a file field set. Promote to frontpage + // Create a new node with a file field set. Promote // needs to be set so this node will appear in the RSS feed. $node = $this->drupalCreateNode(['type' => $type_name, 'promote' => 1]); $test_file = $this->getTestFile('text'); diff --git a/core/modules/forum/config/optional/core.base_field_override.node.forum.promote.yml b/core/modules/forum/config/optional/core.base_field_override.node.forum.promote.yml index be6e1a33..64ddc638 100644 --- a/core/modules/forum/config/optional/core.base_field_override.node.forum.promote.yml +++ b/core/modules/forum/config/optional/core.base_field_override.node.forum.promote.yml @@ -7,8 +7,8 @@ id: node.forum.promote field_name: promote entity_type: node bundle: forum -label: 'Promoted to front page' -description: '' +label: 'Promote' +description: 'A boolean indicating whether the node should be marked as promoted.' required: false translatable: true default_value: diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php index d4402a79..2072bd96 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/BlockFilterTest.php @@ -81,7 +81,7 @@ public function testBlockFilter() { // Get the Content Fields category, which will be closed before filtering. $contentFieldsCategory = $page->find('named', ['content', 'Content fields']); // Link that belongs to the Content Fields category, to verify collapse. - $promoteToFrontPageLink = $page->find('named', ['content', 'Promoted to front page']); + $promoteToFrontPageLink = $page->find('named', ['content', 'Promote']); // Test that front page link is visible until Content Fields collapsed. $this->assertTrue($promoteToFrontPageLink->isVisible()); $contentFieldsCategory->click(); diff --git a/core/modules/node/config/install/system.action.node_promote_action.yml b/core/modules/node/config/install/system.action.node_promote_action.yml index 7c45a42d..a411ec5e 100644 --- a/core/modules/node/config/install/system.action.node_promote_action.yml +++ b/core/modules/node/config/install/system.action.node_promote_action.yml @@ -4,7 +4,7 @@ dependencies: module: - node id: node_promote_action -label: 'Promote content to front page' +label: 'Promote content' type: node plugin: node_promote_action configuration: { } diff --git a/core/modules/node/config/install/system.action.node_unpromote_action.yml b/core/modules/node/config/install/system.action.node_unpromote_action.yml index cb290ddc..8780df37 100644 --- a/core/modules/node/config/install/system.action.node_unpromote_action.yml +++ b/core/modules/node/config/install/system.action.node_unpromote_action.yml @@ -4,7 +4,7 @@ dependencies: module: - node id: node_unpromote_action -label: 'Remove content from front page' +label: 'Remove content' type: node plugin: node_unpromote_action configuration: { } diff --git a/core/modules/node/config/optional/views.view.frontpage.yml b/core/modules/node/config/optional/views.view.frontpage.yml index 71be67ff..c1527c28 100644 --- a/core/modules/node/config/optional/views.view.frontpage.yml +++ b/core/modules/node/config/optional/views.view.frontpage.yml @@ -10,7 +10,7 @@ dependencies: id: frontpage label: Frontpage module: node -description: 'All content promoted to the front page.' +description: 'All promoted content.' tag: default base_table: node_field_data base_field: nid diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 7e194d91..2fbffb80 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -59,7 +59,7 @@ function node_help($route_name, RouteMatchInterface $route_match) { $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Creating content') . '
'; - $output .= '
' . t('When new content is created, the Node module records basic information about the content, including the author, date of creation, and the Content type. It also manages the publishing options, which define whether or not the content is published, promoted to the front page of the site, and/or sticky at the top of content lists. Default settings can be configured for each type of content on your site.', [':content-type' => Url::fromRoute('entity.node_type.collection')->toString()]) . '
'; + $output .= '
' . t('When new content is created, the Node module records basic information about the content, including the author, date of creation, and the Content type. It also manages the publishing options, which define whether or not the content is published, promoted, and/or sticky at the top of content lists. Default settings can be configured for each type of content on your site.', [':content-type' => Url::fromRoute('entity.node_type.collection')->toString()]) . '
'; $output .= '
' . t('Creating custom content types') . '
'; $output .= '
' . t('The Node module gives users with the Administer content types permission the ability to create new content types in addition to the default ones already configured. Creating custom content types gives you the flexibility to add fields and configure default settings that suit the differing needs of various site content.', [':content-new' => Url::fromRoute('node.type_add')->toString(), ':field' => Url::fromRoute('help.page', ['name' => 'field'])->toString()]) . '
'; $output .= '
' . t('Administering content') . '
'; @@ -608,7 +608,7 @@ function node_ranking() { 'score' => 'n.sticky', ], 'promote' => [ - 'title' => t('Content is promoted to the front page'), + 'title' => t('Content is promoted'), // The promote flag is either 0 or 1, which is automatically normalized. 'score' => 'n.promote', ], diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index fdfa6f60..101eb3cd 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -332,7 +332,8 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setTranslatable(TRUE); $fields['promote'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Promoted to front page')) + ->setLabel(t('Promote')) + ->setDescription(t('A boolean indicating whether the node should be marked as promoted.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE) ->setDefaultValue(TRUE) diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index f4742b57..e54b786d 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -150,7 +150,7 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => $workflow_options, '#options' => [ 'status' => $this->t('Published'), - 'promote' => $this->t('Promoted to front page'), + 'promote' => $this->t('Promoted'), 'sticky' => $this->t('Sticky at top of lists'), 'revision' => $this->t('Create new revision'), ], diff --git a/core/modules/node/src/NodeViewsData.php b/core/modules/node/src/NodeViewsData.php index 2f3a8372..9c3a3e77 100644 --- a/core/modules/node/src/NodeViewsData.php +++ b/core/modules/node/src/NodeViewsData.php @@ -47,7 +47,7 @@ public function getViewsData() { ]; $data['node_field_data']['promote']['help'] = $this->t('A boolean indicating whether the node is visible on the front page.'); - $data['node_field_data']['promote']['filter']['label'] = $this->t('Promoted to front page status'); + $data['node_field_data']['promote']['filter']['label'] = $this->t('Promoted status'); $data['node_field_data']['promote']['filter']['type'] = 'yes-no'; $data['node_field_data']['sticky']['help'] = $this->t('A boolean indicating whether the node should sort to the top of content lists.'); diff --git a/core/modules/node/src/Plugin/Action/DemoteNode.php b/core/modules/node/src/Plugin/Action/DemoteNode.php index efacdb42..bbccbe44 100644 --- a/core/modules/node/src/Plugin/Action/DemoteNode.php +++ b/core/modules/node/src/Plugin/Action/DemoteNode.php @@ -10,7 +10,7 @@ * * @Action( * id = "node_unpromote_action", - * label = @Translation("Demote selected content from front page"), + * label = @Translation("Demote selected content."), * type = "node" * ) */ diff --git a/core/modules/node/src/Plugin/Action/PromoteNode.php b/core/modules/node/src/Plugin/Action/PromoteNode.php index 1d0e6169..9ce0cf1e 100644 --- a/core/modules/node/src/Plugin/Action/PromoteNode.php +++ b/core/modules/node/src/Plugin/Action/PromoteNode.php @@ -10,7 +10,7 @@ * * @Action( * id = "node_promote_action", - * label = @Translation("Promote selected content to front page"), + * label = @Translation("Promote selected content"), * type = "node" * ) */ diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index af8c27c4..61d78545 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -38,7 +38,7 @@ * teaser would result in: "node--view-mode-teaser", and * full: "node--view-mode-full". * The following are controlled through the node publishing options. - * - node--promoted: Appears on nodes promoted to the front page. + * - node--promoted: Appears on promoted nodes. * - node--sticky: Appears on nodes ordered above other non-sticky nodes in * teaser listings. * - node--unpublished: Appears on unpublished nodes visible only to site diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php index cdbd7b63..2855833a 100644 --- a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php +++ b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php @@ -148,21 +148,21 @@ public function testBulkForm() { $node = $this->loadNode($node->id()); $this->assertFalse($node->isSticky(), 'Node is not sticky anymore'); - // Promote to front page. - $this->assertFalse($node->isPromoted(), 'Node is not promoted to the front page'); - $this->assertFalse($node->getTranslation('en-gb')->isPromoted(), 'Node translation is not promoted to the front page'); - $this->assertFalse($node->getTranslation('it')->isPromoted(), 'Node translation is not promoted to the front page'); + // Promote content. + $this->assertFalse($node->isPromoted(), 'Node is not promoted'); + $this->assertFalse($node->getTranslation('en-gb')->isPromoted(), 'Node translation is not promoted'); + $this->assertFalse($node->getTranslation('it')->isPromoted(), 'Node translation is not promoted'); $edit = [ 'node_bulk_form[0]' => TRUE, 'action' => 'node_promote_action', ]; $this->submitForm($edit, 'Apply to selected items'); $node = $this->loadNode($node->id()); - $this->assertTrue($node->isPromoted(), 'Node has been promoted to the front page'); - $this->assertFalse($node->getTranslation('en-gb')->isPromoted(), 'Node translation has not been promoted to the front page'); - $this->assertFalse($node->getTranslation('it')->isPromoted(), 'Node translation has not been promoted to the front page'); + $this->assertTrue($node->isPromoted(), 'Node has been promoted'); + $this->assertFalse($node->getTranslation('en-gb')->isPromoted(), 'Node translation has not been promoted'); + $this->assertFalse($node->getTranslation('it')->isPromoted(), 'Node translation has not been promoted'); - // Demote from front page. + // Demote content. $edit = [ 'node_bulk_form[0]' => TRUE, 'action' => 'node_unpromote_action', diff --git a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php index ef1d9236..269ffb6f 100644 --- a/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php +++ b/core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php @@ -50,7 +50,7 @@ public function testWorkflowSummary() { return strpos('Not published', $summary) !== FALSE; }); $summary = $page->find('css', $locator)->getText(); - $this->assertEquals('Not published, Promoted to front page, Sticky at top of lists, Create new revision', $summary); + $this->assertEquals('Not published, Promoted, Sticky at top of lists, Create new revision', $summary); } } diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php index f91b9f72..e74a9082 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php @@ -100,7 +100,7 @@ protected function getFileMigrationInfo() { * @param int $changed * The expected modification time. * @param bool $promoted - * Whether the node is expected to be promoted to the front page. + * Whether the node is expected to be promoted. * @param bool $sticky * Whether the node is expected to be sticky. * diff --git a/core/profiles/standard/config/install/core.base_field_override.node.page.promote.yml b/core/profiles/standard/config/install/core.base_field_override.node.page.promote.yml index 27226a1a..cdda28a2 100644 --- a/core/profiles/standard/config/install/core.base_field_override.node.page.promote.yml +++ b/core/profiles/standard/config/install/core.base_field_override.node.page.promote.yml @@ -7,8 +7,8 @@ id: node.page.promote field_name: promote entity_type: node bundle: page -label: 'Promoted to front page' -description: '' +label: 'Promote' +description: 'A boolean indicating whether the node should be marked as promoted.' required: false translatable: false default_value: diff --git a/core/themes/claro/templates/classy/content/node.html.twig b/core/themes/claro/templates/classy/content/node.html.twig index 1b15c777..b6abb710 100644 --- a/core/themes/claro/templates/classy/content/node.html.twig +++ b/core/themes/claro/templates/classy/content/node.html.twig @@ -38,7 +38,7 @@ * teaser would result in: "node--view-mode-teaser", and * full: "node--view-mode-full". * The following are controlled through the node publishing options. - * - node--promoted: Appears on nodes promoted to the front page. + * - node--promoted: Appears on promoted nodes. * - node--sticky: Appears on nodes ordered above other non-sticky nodes in * teaser listings. * - node--unpublished: Appears on unpublished nodes visible only to site