diff --git a/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php b/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php index 96b1720..f8e407d 100644 --- a/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php +++ b/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php @@ -14,17 +14,13 @@ * {@inheritdoc} */ public static function publishedBaseFieldDefinitions(EntityTypeInterface $entityType) { - $definitions = []; - $key = self::getPublishedEntityKey($entityType); - $definitions[$key] = BaseFieldDefinition::create('boolean') + return [$key => BaseFieldDefinition::create('boolean') ->setLabel(new TranslatableMarkup('Publishing status')) ->setDescription(new TranslatableMarkup('A boolean indicating the published state.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setDefaultValue(TRUE); - - return $definitions; + ->setDefaultValue(TRUE)]; } /** @@ -78,13 +74,13 @@ public function unpublish() { /** * Used to determine which key is used to represent the published state. * - * @param EntityTypeInterface $entityType + * @param \Drupal\Core\Entity\EntityTypeInterface $entityType * The entity type to find the published key for. * * @return string * The configured entity type definition key for 'status', or defaults to * 'status'. - * @see Drupal\Core\Entity\Annotation\ContentEntityType + * @see \Drupal\Core\Entity\Annotation\ContentEntityType */ protected static function getPublishedEntityKey(EntityTypeInterface $entityType) { return $entityType->getKey('status') ?: 'status';