Problem/Motivation

As decided in #2745619: [policy, no patch] Which core entities get revisions?, custom menu links should be converted to be revisionable.

The main use case that the Workflow Initiative proposed for this change is site-wide previews of not yet published content (nodes, media items, taxonomy terms, menu links, etc.), through the Workspaces module.

Note that revision support for the menu hierarchy will not been added in this issue, and it is being discussed in #3035089: Menu link hierarchy should be revision-aware.

Proposed resolution

Convert custom menu links to be revisionable using the new API introduced in #2984782: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data.

Remaining tasks

Review/commit/celebrate.

User interface changes

None yet, revision support is only enabled at the API level.

API changes

API additions:

  • \Drupal\menu_link_content\Entity\MenuLinkContent now extends the \Drupal\Core\Entity\EditorialContentEntityBase base entity class
  • The \Drupal\menu_link_content\Entity\MenuLinkContent entity type has a new entity-level constraint (MenuTreeHierarchy) which prevents the parent and weight fields from being updated when creating a pending revision
  • \Drupal\menu_link_content\MenuLinkContentInterface now implements \Drupal\Core\Entity\RevisionLogInterface

Data model changes

Custom menu links are now revisionable.

Release notes snippet

Custom menu links are now revisionable, which allows them to take part in editorial workflows like other first-class entity types in core, for example Content, Media items and Custom blocks.

CommentFileSizeAuthor
#64 interdiff-64.txt6.77 KBamateescu
#64 2880152-64.patch43.09 KBamateescu
#62 interdiff-62.txt4.53 KBamateescu
#62 2880152-62.patch43.46 KBamateescu
#61 drupal_8x_dev.sql_.gz7.17 MBplach
#59 interdiff-59.txt4.4 KBamateescu
#59 2880152-59.patch42.18 KBamateescu
#50 interdiff-50.txt12.17 KBamateescu
#50 2880152-50.patch41.15 KBamateescu
#45 2880152-45.patch37.98 KBamateescu
#44 interdiff-44.txt7.68 KBamateescu
#44 2880152-44.patch56.02 KBamateescu
#43 interdiff-43.txt1010 bytesamateescu
#43 2880152-43.patch31.83 KBamateescu
#41 interdiff-41.txt14.08 KBamateescu
#41 2880152-41.patch31.79 KBamateescu
#39 2880152-39.patch18.32 KBamateescu
#38 2880152-38-combined.patch89.66 KBamateescu
#36 2880152-36-combined.patch88.18 KBamateescu
#36 2880152-36-for-review.patch18.32 KBamateescu
#33 2880152-33-combined.patch88.74 KBamateescu
#32 interdiff-32.txt11.1 KBamateescu
#32 2880152-32-combined.patch87.95 KBamateescu
#32 2880152-32-for-review.patch19.08 KBamateescu
#31 2880152-31.patch82.24 KBblazey
#30 interdiff-30.txt893 bytesamateescu
#30 2880152-30-combined.patch161.55 KBamateescu
#30 2880152-30-for-review.patch18.96 KBamateescu
#29 interdiff-29.txt9.99 KBamateescu
#29 2880152-29-combined.patch161.84 KBamateescu
#29 2880152-29-for-review.patch18.08 KBamateescu
#25 2880152-25.patch14.59 KBamateescu
#23 interdiff-23.txt653 bytesamateescu
#23 2880152-23.patch17.98 KBamateescu
#21 interdiff-21.txt5.24 KBamateescu
#21 2880152-21.patch17.34 KBamateescu
#14 interdiff.txt884 bytesamateescu
#14 2880152-14.patch16.39 KBamateescu
#11 2880152-11.patch16.38 KBamateescu
#5 interdiff.txt3.97 KBamateescu
#4 2880152-4-combined.patch68.32 KBamateescu
#4 2880152-4.patch16.38 KBamateescu
#2 2880152-combined.patch64.35 KBamateescu
#2 2880152.patch12.42 KBamateescu

Comments

amateescu created an issue. See original summary.

amateescu’s picture

Status: Needs review » Needs work

The last submitted patch, 2: 2880152-combined.patch, failed testing.

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new16.38 KB
new68.32 KB

This should fix most of the fails. Drupal\system\Tests\Update\UpdatePathWithBrokenRoutingFilledTest is a bit weird and I don't really understand what it does, so I'm going to ask @dawehner for some help with that one.

amateescu’s picture

StatusFileSize
new3.97 KB

And the interdiff.

Status: Needs review » Needs work

The last submitted patch, 4: 2880152-4-combined.patch, failed testing.

timmillwood’s picture

Title: [PP-3] Convert custom menu links to be revisionable » [PP-1] Convert custom menu links to be revisionable
Status: Needs work » Postponed

Looks like this just depends on one issue now, #2860654: Field storage CRUD operations must use the last installed entity type and field storage definitions, which is RTBC.
If we can get this ready maybe it can get in 8.4.0 too?

timmillwood’s picture

Status: Postponed » Needs review

It looks as though the patch in #4 still applies, so queuing a test for it.

The last submitted patch, 4: 2880152-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

amateescu’s picture

Status: Needs review » Postponed

This patch is not ready for the testbot until the other one gets in, that's why I didn't queue any test run so far.

amateescu’s picture

Status: Postponed » Needs review
StatusFileSize
new16.38 KB

The blocker is in! Let's see how a fresh patch is doing here :)

timmillwood’s picture

Title: [PP-1] Convert custom menu links to be revisionable » Convert custom menu links to be revisionable

Status: Needs review » Needs work

The last submitted patch, 11: 2880152-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

amateescu’s picture

Assigned: Unassigned » dawehner
Status: Needs work » Needs review
StatusFileSize
new16.39 KB
new884 bytes

This fixes the REST fails but I still need some help with #4, let's try asking @dawehner :)

Status: Needs review » Needs work

The last submitted patch, 14: 2880152-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

wim leers’s picture

+++ b/core/modules/rest/tests/src/Functional/EntityResource/MenuLinkContent/MenuLinkContentResourceTestBase.php
@@ -106,6 +106,11 @@ protected function getExpectedNormalizedEntity() {
+      'revision_id' => [
+        [
+          'value' => 1,
+        ],
+      ],

@@ -172,6 +177,11 @@ protected function getExpectedNormalizedEntity() {
+      'revision_created' => [
+        $this->formatExpectedTimestampItemValues((int) $this->entity->getRevisionCreationTime()),
+      ],
+      'revision_user' => [],
+      'revision_log_message' => [],

See #2880154-11: Convert comments to be revisionable.

This is technically a BC break for API-First… I'll let core committers decide here.

dawehner’s picture

I'll try to help out with #4 tonight.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

voleger’s picture

Menu Link Content has a bug with current base field definitions.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

amateescu’s picture

Status: Needs work » Needs review
Issue tags: -API-First Initiative, -BC break
StatusFileSize
new17.34 KB
new5.24 KB

Rerolled the latest patch and made a few improvements based on all the reviews from #2880149: Convert taxonomy terms to be revisionable.

I'm pretty sure we still need @dawehner's help for #4 :)

Status: Needs review » Needs work

The last submitted patch, 21: 2880152-21.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new17.98 KB
new653 bytes

This fixes MenuLinkContentDeleteTest, will still fail so not sending this one to the testbot.

amateescu’s picture

I've split the "publishable" part to a separate issue: #2981915: Update MenuLinkContent to use EntityPublishedInterface

amateescu’s picture

Status: Needs review » Postponed
StatusFileSize
new14.59 KB

Rebased the patch on top of #2981915-2: Update MenuLinkContent to use EntityPublishedInterface, still not ready for the testbot.

catch’s picture

berdir’s picture

Would have belonged more in the other issue, but it's not something to solve for either, just mentioning as related for now.

The weird thing about this one, for historical reasons, is that it's called enabled and not status.

The problem is that content_translation additional field logic predates having a status/published entity key, and as a result, it hardcodes the field name to status, what it does is use that if it exists and if not, then it creates it own. So you have a then a translation status and an enabled key, and neither works as expected for menu links (It's not possible to have an unpublished menu link for a specific translation, as enabled is not translatble and nothing looks at translation_status when it matters). Afaik the menu system actually can't handle a status that varies per language at all.

So basically, if we'd decide to "fix" content_translation to look at the published key instead of hardcoding a field named "status", then things would break in interesting ways..

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

amateescu’s picture

StatusFileSize
new18.08 KB
new161.84 KB
new9.99 KB

@Berdir, I was also thinking about that problem at some point, but I was lazy so thanks for writing it down :) I opened #3005398: Content Translation should use EntityPublishedInterface or the 'published' entity key to determine if it needs to add its 'content_translation_status' field and #3005400: The menu system can't handle the publishing status of a menu link that varies per language so we have some actionable issues at least.

In the meantime, updated the patch to use the entity schema update API from #2984782-19: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data. Leaving at NW because I'm pretty sure the test fail from #14 is still there. Ping @dawehner :P

amateescu’s picture

Assigned: dawehner » Unassigned
Priority: Normal » Major
Status: Needs work » Postponed
StatusFileSize
new18.96 KB
new161.55 KB
new893 bytes

Spent some time looking into this test fail and I finally understood what's going on: the conditional exception thrown by \Drupal\update_script_test\PathProcessor\BrokenInboundPathProcessor::processInbound() makes all save operations on a menu_link_content entity fail, and the only reason why the upgrade path we're adding in this patch appears to fail is simply because it's the first post_update function which saves a menu_link_content entity, when tested with a filled db dump :)

Then I went digging into the history of UpdatePathWithBrokenRoutingTest which was introduced in #2550601: Move update.php to a more acceptable location (note that it's not using the filled db dump), and the purpose of the test is pretty clear: check that database updates can be executed through update.php even when Drupal's router is in a "broken" state.

Now, the problematic test class (UpdatePathWithBrokenRoutingFilledTest, note the "filled" part) was introduced in #2551341: Update test database dump should be based on beta 12 and contain content for no obvious reason. \Drupal\update_script_test\PathProcessor\BrokenInboundPathProcessor::processInbound() does not act differently based on whether there is some content or not in the database.

So the only conclusion that I can come up with is that UpdatePathWithBrokenRoutingFilledTest does not serve any real purpose and can be removed :)

blazey’s picture

Status: Postponed » Needs review
StatusFileSize
new82.24 KB

Here's the patch from #31 re-rolled on top of #2984782: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data (#29). The for-review part hasn't changed.

amateescu’s picture

StatusFileSize
new19.08 KB
new87.95 KB
new11.1 KB

Updated the patch for the changes in #2984782-39: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data. Also, since we're not invoking hooks anymore during the conversion process, we can use a regular update function!

amateescu’s picture

StatusFileSize
new88.74 KB

Rerolled the combined patch, the for review one is the same as #32.

The last submitted patch, 32: 2880152-32-combined.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 33: 2880152-33-combined.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new18.32 KB
new88.18 KB

It turns out that #32 was not entirely correct because updating an entity type invokes events, and that's also something that we can't do in regular update functions.

This patch reverts the interdiff from #32 and applies properly on top of #2984782-42: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data.

Status: Needs review » Needs work

The last submitted patch, 36: 2880152-36-combined.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new89.66 KB

Rerolled the combined patch to include the latest fixes from #2984782-45: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data. The for review one from #36 doesn't need any change.

amateescu’s picture

StatusFileSize
new18.32 KB

#2880152: Convert custom menu links to be revisionable is in! Re-uploading the for-review patch from #36.

cosmicdreams’s picture

amateescu’s picture

StatusFileSize
new31.79 KB
new14.08 KB

@cosmicdreams, oops, yes, that's what I meant :)

Brought this patch inline with the UI and functionality provided for taxonomy terms in #2880149: Convert taxonomy terms to be revisionable.

Status: Needs review » Needs work

The last submitted patch, 41: 2880152-41.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new31.83 KB
new1010 bytes

Let's not change any UI strings if not strictly needed.

amateescu’s picture

StatusFileSize
new56.02 KB
new7.68 KB

Until now, this patch has been an exact copy of the one for taxonomy terms, but, after doing some manual testing, I think we shouldn't enable Content Moderation support for custom menu links because they don't have a standalone "view" page, which means that the 'latest revision' tab added by Content Moderation looks very confusing.

Fixed a couple of things and added test coverage for the constraint and for making sure that the menu tree is not updated when a pending revision is saved.

amateescu’s picture

StatusFileSize
new37.98 KB

The patch from #44 was generated from a stale branch. Rerolled it using the patch from #43 and the interdiff from #44.

vijaycs85’s picture

Looks good +1 to RTBC. Here is the detailed summary:

Case 1:
1. Applied patch in #45 locally on an existing 8.7.x site.
2. drush updb shows the post_update and performs without any error.
3. Created new menu item (under footer menu) and works as usual.

Case 2:
1. Applied patch in #45 locally and installed a 8.7.x site.
2. Created/Updated/deleted a menu item (under footer menu) and works as usual.
3. Editing system provided default item works and no impact on the menu_link_data_* tables as expected.

+++ b/core/modules/menu_link_content/menu_link_content.module
@@ -29,6 +29,16 @@ function menu_link_content_help($route_name, RouteMatchInterface $route_match) {
+  //   for them.
+  //   @see https://www.drupal.org/project/drupal/issues/2350939

nitpick: too many spaces.


Note: Few notes if anyone else manually testing (thanks @amateescu for the clarification on slack)
- As it's just API (no UI) change, we can't make a "new revision". Meaning any update to a menu item would be updated to revision id=1 (see menu_link_content_revision and menu_link_content_field_revision compare to node_revision and node_field_revision)
- Checking unpublished revision constraints (e.g. no drag and drop) is not possible via UI.
amateescu’s picture

Thanks for the review, @vijaycs85!

Regarding that nitpick, the extra spaces are there to point out that the @see tag is part of the @todo above. With the extra spaces, IDEs like PHPStorm will highlight the @see in the same color as the @todo, which is usually different than the color for regular comments. We also have other examples of this pattern in core if you search for // @see :)

vijaycs85’s picture

Status: Needs review » Reviewed & tested by the community

he extra spaces are there to point out that the @see tag is part of the @todo above. With the extra spaces, IDEs like PHPStorm will highlight the @see in the same color as the @todo, which is usually different than the color for regular comments. We also have other examples of this pattern in core if you search for // @see :)

Cool.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
    @@ -531,6 +531,8 @@ protected function postUpdateEntityTypeSchema(EntityTypeInterface $entity_type,
    +      $this->storage->setTableMapping($new_table_mapping);
    +
    

    can you elaborate on why this change is needed?

  2. +++ b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
    @@ -127,19 +127,11 @@ public function buildEntity(array $form, FormStateInterface $form_state) {
    -    else {
    -      $this->messenger()->addError($this->t('There was an error saving the menu link.'));
    -      $form_state->setRebuild();
    -    }
    +    $menu_link->save();
    

    any reason why we dropped this?

  3. +++ b/core/modules/menu_link_content/src/MenuLinkContentStorage.php
    @@ -0,0 +1,44 @@
    +    $inner_select = $this->database->select($this->getRevisionDataTable(), 't');
    +    $inner_select->condition("t.$rta_field", '1');
    +    $inner_select->fields('t', [$id_field, $langcode_field]);
    +    $inner_select->addExpression("MAX(t.$revision_field)", $revision_field);
    +    $inner_select
    +      ->groupBy("t.$id_field")
    +      ->groupBy("t.$langcode_field");
    +
    +    $query->join($inner_select, 'mr', "mlfr.$revision_field = mr.$revision_field AND mlfr.$langcode_field = mr.$langcode_field");
    +
    +    $query->groupBy("mlfr.$id_field");
    +
    +    return $query->execute()->fetchAllKeyed(1, 0);
    

    would be good to see the EXPLAIN output on this query

  4. +++ b/core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraintValidator.php
    @@ -0,0 +1,61 @@
    +      if (!$entity->parent->isEmpty() && !$original->parent->isEmpty() && !$entity->parent->equals($original->parent)) {
    +        $this->context->buildViolation($constraint->message)
    

    what if one has no parent, but the new one now does? shouldn't that trigger the message too? if so, missing tests for that too.

  5. +++ b/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php
    @@ -59,6 +59,43 @@ public function testPublishedEntityKeyAddition() {
    +    $this->runUpdates();
    

    can we assert before running the updates the state we expect the test fixture to initialize the site in to guard against accidental updates to the fixture that contain the revision support.

  6. +++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentDeriverTest.php
    @@ -26,6 +26,7 @@ class MenuLinkContentDeriverTest extends KernelTestBase {
    +    $this->installEntitySchema('user');
    
    +++ b/core/modules/menu_link_content/tests/src/Kernel/PathAliasMenuLinkContentTest.php
    @@ -26,6 +26,7 @@ class PathAliasMenuLinkContentTest extends KernelTestBase {
    +    $this->installEntitySchema('user');
    

    should we use the new current user trait here ?

  7. +++ b/core/modules/menu_ui/src/MenuForm.php
    @@ -267,6 +279,30 @@ protected function buildOverviewForm(array &$form, FormStateInterface $form_stat
    +    $pending_menu_link_ids = $this->menuLinkContentStorage->getMenuLinkIdsWithPendingRevisions();
    

    This menu form is for one menu, yet we prevent table drag if there are any menu links with pending revisions (ie. we don't filter this by menu).

    That feels wrong, and probably indicates missing test coverage?

    We definitely should be filtering to the menu being edited in my book.

    Otherwise you get the message, but have no idea which link is pending because its in a different menu.

  8. +++ b/core/modules/menu_ui/src/MenuForm.php
    @@ -283,6 +319,12 @@ protected function buildOverviewForm(array &$form, FormStateInterface $form_stat
    +          $form['links'][$id]['#attributes']['class'][] = 'menu-link-content-pending-revision';
    

    should this use BEM --pending-revision instead of -pending-revision?

  9. +++ /dev/null
    @@ -1,21 +0,0 @@
    -namespace Drupal\Tests\system\Functional\Update;
    -
    -/**
    - * Runs UpdatePathWithBrokenRoutingTest with a dump filled with content.
    - *
    - * @group Update
    - * @group legacy
    - */
    -class UpdatePathWithBrokenRoutingFilledTest extends UpdatePathWithBrokenRoutingTest {
    -
    -  /**
    -   * {@inheritdoc}
    -   */
    -  protected function setDatabaseDumpFiles() {
    -    parent::setDatabaseDumpFiles();
    -    $this->databaseDumpFiles[0] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
    -  }
    

    any reason for removing this?

  10. +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
    @@ -41,6 +41,7 @@ class MenuLinkTreeTest extends KernelTestBase {
    +    'user',
    
    @@ -49,6 +50,7 @@ class MenuLinkTreeTest extends KernelTestBase {
    +    $this->installEntitySchema('user');
    

    same here - can we use the new current user trait?

amateescu’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new41.15 KB
new12.17 KB

Thanks for the great review!

  1. I was debugging running entity schema updates with Drush. Removed it from this patch and I'll open a separate issue for it.
  2. That's because \Drupal\Core\Entity\ContentEntityStorageBase::doSave() return FALSE when saving a pending revision (https://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Entity/Cont...), so a content entity form can not rely on its return value for checking whether the save was successful. Instead, an exception is triggered by the storage.
  3. Posted the EXPLAIN for the identical query form the taxonomy links conversion patch in #2880149-265: Convert taxonomy terms to be revisionable.
  4. Very good point! Fixed and added test coverage.
  5. Sure thing, done.
  6. We don't need the user creation trait because we don't have to create a user, those tests need only to have the entity type definition and the database tables available.
  7. Another excellent point :) Fixed and added test coverage.
  8. Yup, fixed.
  9. The reason for removing that test is explained in #30.
  10. Same as above, we don't need to use the trait.
larowlan’s picture

+++ b/core/modules/menu_ui/src/MenuForm.php
@@ -279,9 +280,19 @@ protected function buildOverviewForm(array &$form, FormStateInterface $form_stat
+    $edited_ids = array_filter(array_map(function ($element) {
+      return is_array($element) && isset($element['#item']) && $element['#item']->link instanceof MenuLinkContent ? $element['#item']->link->getMetaData()['entity_id'] : NULL;
+    }, $links));
+    $pending_menu_link_ids = array_intersect($this->menuLinkContentStorage->getMenuLinkIdsWithPendingRevisions(), $edited_ids);

we're still not filtering by menu here?

amateescu’s picture

We can't, it's the same story as the one for taxonomy terms :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 50: 2880152-50.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Reviewed & tested by the community

Random fail in CKEditorIntegrationTest::testDrupalImageCaptionDialog, queued a re-test.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

plach’s picture

Version: 8.8.x-dev » 8.7.x-dev
  1. +++ b/core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraintValidator.php
    @@ -0,0 +1,61 @@
    + * Constraint validator for changing term parents in pending revisions.
    ...
    +   * Creates a new TaxonomyTermHierarchyConstraintValidator instance.
    

    Liar :D

  2. +++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php
    @@ -310,4 +310,99 @@ public function testModuleUninstalledMenuLinks() {
    +    // Check that changing the parent or the weight in a pending revision is not
    +    // allowed.
    +    $child2_pending_revision = $storage->createRevision($child2, FALSE);
    +    $child2_pending_revision->set('parent', $child1->id());
    +    $child2_pending_revision->set('weight', 500);
    +    $violations = $child2_pending_revision->validate();
    +    $this->assertCount(2, $violations);
    

    Can we also assert that changing either of the two triggers the same validation error?

  3. +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
    @@ -987,4 +987,38 @@ protected function doTestMenuBlock() {
    +    $child_1 = $this->addMenuLink($root_1->getPluginId(), '/', $menu_1->id());
    

    $child_1 seems unused.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

plach’s picture

.

amateescu’s picture

StatusFileSize
new42.18 KB
new4.4 KB

Thanks for the review!

Re #56:

  1. Oops, busted :)
  2. Sure thing.
  3. Yup, fixed.
plach’s picture

This still needs a CR and release note snippets. Additionally the IS should mention the plan to make the hierarchy revisionable.

plach’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new7.17 MB

I manually tested this by manually restoring Content Moderation support (git hash 2c166a50a611b06d85c8d8ae482c6a76a196a4c6 + #59) and it doesn't seem to work properly in a few scenarios:

  • I tried to save a root menu link as draft and I got the You can only change the hierarchy for the published version of this menu link. validation error even if I didn't touch the parent or weight fields.
  • I then tried to save a child menu link as draft and it did work, however when I got back to the menu page, the "enabled" checkbox was still available. That should be disabled as well for drafts, because it saves a default revision overriding the draft. Additionally it triggers a notice: Notice: Undefined index: weight in Drupal\menu_ui\MenuForm->submitOverviewForm() (line 515 of core/modules/menu_ui/src/MenuForm.php).

I'm attaching the test DB dump in case it helps reproducing the issues.

amateescu’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs issue summary update, -Needs change record, -Needs release note
StatusFileSize
new43.46 KB
new4.53 KB

Thanks for the additional review, fixed both points :) Explicit test coverage for the first item will be added in #3039031: FieldItemList::equals() should filter out the empty items before checking their count.

Added a CR (https://www.drupal.org/node/3039034), updated the IS and included a release note snippet.

plach’s picture

amateescu’s picture

StatusFileSize
new43.09 KB
new6.77 KB

Here's an update with a few more refinements pointed out by @plach:

- we should use ['#access'] = FALSE to hide the 'Enabled' checkbox for pending revisions, and also add test coverage for it
- we can bring back UpdatePathWithBrokenRoutingFilledTest because the "fieldable update API" is no longer using the storage save() operation but a new restore() one instead.

plach’s picture

Thanks, I think this is ready to go now.

plach’s picture

Saving credits.

plach’s picture

Trying again.

  • plach committed 5ad8f59 on 8.8.x
    Issue #2880152 by amateescu, blazey, plach, larowlan, vijaycs85: Convert...
plach’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5ad8f59 and pushed to 8.8.x and to 8.7.x as fbdccdc952c53fce12a81ac6640514c52e5fc3af.

Celebration time now!

  • plach committed fbdccdc on 8.7.x
    Issue #2880152 by amateescu, blazey, plach, larowlan, vijaycs85: Convert...
dixon_’s picture

Huge thanks to everyone involved in coding, reviewing, triaging, committing, promoting and cheering on! Such a great milestone!

plach’s picture

Version: 8.8.x-dev » 8.7.x-dev
amateescu’s picture

Issue tags: +8.7.0 highlights

/me celebrates by adding this tag :D

plach’s picture

Issue tags: +8.7.0 release notes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.