With \Drupal\Core\Config\Entity\ConfigEntityBase::sort, core seems to be encouraging sorting logic to for config entities to sit within the config entity itself. We currently do our sorting using Page::variantSortHelper.

We could switch over to this pattern by moving Page::variantSortHelper into PageVariant::sort.

We could potentially even use ConfigEntityBase::sort, but that comes with the following caveats:

  • PageVariant::$weight is required to be public (though we could post a core issue to switch to using $a->get('weight') rather than $a->weight).
  • ConfigEntityBase::sort uses label as a secondary comparison if weights are equal. This may not be desirable.

Comments

andrewbelcher created an issue. See original summary.

andrewbelcher’s picture

I have left this postponed on #2692397: Adding/removing variants leaves Page::$variants out of date as that will be moving the calls that use this and it'll be simpler to deal with this after that's committed rather than track it.

japerry’s picture

Status: Postponed » Closed (outdated)

Page Manager 8.x-1.x is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.