Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
One of the last remaining @todos in content moderation reads:
// @todo what if $entity->moderation_state is null at this point?
This is found in a protected method EntityOperations::updateOrCreateFromEntity
which is called only for moderated entities:
public function entityInsert(EntityInterface $entity) {
if ($this->moderationInfo->isModeratedEntity($entity)) {
$this->updateOrCreateFromEntity($entity);
}
}
Proposed resolution
The moderation_state field is never NULL for non-moderated entities. Add a test case for this and remove the todo.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#2 | 2973493-2.patch | 1.5 KB | Sam152 |
Comments
Comment #2
Sam152 CreditAttribution: Sam152 at PreviousNext commentedComment #3
timmillwoodThanks @Sam152!
Removes a @todo question by answering it with a test! Perfect!
Comment #4
alexpottCommitted and pushed add4d39507 to 8.6.x and a9333869bb to 8.5.x. Thanks!