/**
* {@inheritdoc}
*/ publicfunctiongetUnsupportedFeatures(EntityTypeInterface $entity_type){ $features = []; // Test if entity is publishable.
if(!$entity_type->entityClassImplements(EntityPublishedInterface::class)){ $features['publishing'] = $this->t("@entity_type_plural_label do not support publishing statuses. For example, even after transitioning from a published workflow state to an unpublished workflow state they will still be visible to site visitors.", ['@entity_type_plural_label' => $entity_type->getCollectionLabel()]); } return$features; }
protectedfunctiongetCollectionRoute(EntityTypeInterface $entity_type){ // If the entity type does not provide an admin permission, there is no way
// to control access, so we cannot provide a route in a sensible way.
if($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()&&($admin_permission = $entity_type->getAdminPermission())){ /** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */ $label = $entity_type->getCollectionLabel();
// Keep the first word as it is for nouns that are all capital letters
// (like RDF, URL alias etc.) so we can't run strtolower() for the entire
// string. Special cases may need to be added to this test in the future
// if an acronym is in a different position in the label.
$first_word = strtok($label_string, " "); $remaining_string = strtolower(strstr($label_string, " ")); $this->assertEquals($first_word . $remaining_string, $label_string);
publicfunctionvalidate($value, Constraint $constraint){ // The validator should run only if we are in a active workspace context.
if(!$this->workspaceManager->hasActiveWorkspace()){ return; }