diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 9eba621..9e144ff 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -110,7 +110,7 @@ class EntityType implements EntityTypeInterface { /** * The name of a callback that returns the label of the entity. * - * @var string|null + * @var callable|null * * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. */ diff --git a/core/lib/Drupal/Core/Entity/EntityType.php.orig b/core/lib/Drupal/Core/Entity/EntityType.php.orig deleted file mode 100644 index 3a32d4a..0000000 --- a/core/lib/Drupal/Core/Entity/EntityType.php.orig +++ /dev/null @@ -1,793 +0,0 @@ - static::ID_MAX_LENGTH) { - throw new EntityTypeIdLengthException('Attempt to create an entity type with an ID longer than ' . static::ID_MAX_LENGTH . " characters: {$definition['id']}."); - } - - foreach ($definition as $property => $value) { - $this->{$property} = $value; - } - - // Ensure defaults. - $this->entity_keys += array( - 'revision' => '', - 'bundle' => '', - 'langcode' => '', - 'default_langcode' => 'default_langcode', - ); - $this->handlers += array( - 'access' => 'Drupal\Core\Entity\EntityAccessControlHandler', - ); - - // Automatically add the EntityChanged constraint if the entity type tracks - // the changed time. - if ($this->isSubclassOf('Drupal\Core\Entity\EntityChangedInterface') ) { - $this->addConstraint('EntityChanged'); - } - - // Ensure a default list cache tag is set. - if (empty($this->list_cache_tags)) { - $this->list_cache_tags = [$definition['id'] . '_list']; - } - - } - - /** - * {@inheritdoc} - */ - public function get($property) { - return isset($this->{$property}) ? $this->{$property} : NULL; - } - - /** - * {@inheritdoc} - */ - public function set($property, $value) { - $this->{$property} = $value; - return $this; - } - - /** - * {@inheritdoc} - */ - public function isStaticallyCacheable() { - return $this->static_cache; - } - - /** - * {@inheritdoc} - */ - public function isRenderCacheable() { - return $this->render_cache; - } - - /** - * {@inheritdoc} - */ - public function isPersistentlyCacheable() { - return $this->persistent_cache; - } - - /** - * {@inheritdoc} - */ - public function getKeys() { - return $this->entity_keys; - } - - /** - * {@inheritdoc} - */ - public function getKey($key) { - $keys = $this->getKeys(); - return isset($keys[$key]) ? $keys[$key] : FALSE; - } - - /** - * {@inheritdoc} - */ - public function hasKey($key) { - $keys = $this->getKeys(); - return !empty($keys[$key]); - } - - /** - * {@inheritdoc} - */ - public function id() { - return $this->id; - } - - /** - * {@inheritdoc} - */ - public function getProvider() { - return $this->provider; - } - - /** - * {@inheritdoc} - */ - public function getClass() { - return $this->class; - } - - /** - * {@inheritdoc} - */ - public function getOriginalClass() { - return $this->originalClass ?: $this->class; - } - - /** - * {@inheritdoc} - */ - public function setClass($class) { - if (!$this->originalClass && $this->class) { - // If the original class is currently not set, set it to the current - // class, assume that is the original class name. - $this->originalClass = $this->class; - } - $this->class = $class; - return $this; - } - - /** - * {@inheritdoc} - */ - public function isSubclassOf($class) { - return is_subclass_of($this->getClass(), $class); - } - - /** - * {@inheritdoc} - */ - public function getHandlerClasses() { - return $this->handlers; - } - - /** - * {@inheritdoc} - */ - public function getHandlerClass($handler_type, $nested = FALSE) { - if ($this->hasHandlerClass($handler_type, $nested)) { - $handlers = $this->getHandlerClasses(); - return $nested ? $handlers[$handler_type][$nested] : $handlers[$handler_type]; - } - } - - /** - * {@inheritdoc} - */ - public function setHandlerClass($handler_type, $value) { - $this->handlers[$handler_type] = $value; - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasHandlerClass($handler_type, $nested = FALSE) { - $handlers = $this->getHandlerClasses(); - if (!isset($handlers[$handler_type]) || ($nested && !isset($handlers[$handler_type][$nested]))) { - return FALSE; - } - $handler = $handlers[$handler_type]; - if ($nested) { - $handler = $handler[$nested]; - } - return class_exists($handler); - } - - /** - * {@inheritdoc} - */ - public function getStorageClass() { - return $this->getHandlerClass('storage'); - } - - /** - * {@inheritdoc} - */ - public function setStorageClass($class) { - $this->handlers['storage'] = $class; - } - - /** - * {@inheritdoc} - */ - public function getFormClass($operation) { - return $this->getHandlerClass('form', $operation); - } - - /** - * {@inheritdoc} - */ - public function setFormClass($operation, $class) { - $this->handlers['form'][$operation] = $class; - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasFormClasses() { - return !empty($this->handlers['form']); - } - - /** - * {@inheritdoc} - */ - public function hasRouteProviders() { - return !empty($this->handlers['route_provider']); - } - - /** - * {@inheritdoc} - */ - public function getListBuilderClass() { - return $this->getHandlerClass('list_builder'); - } - - /** - * {@inheritdoc} - */ - public function setListBuilderClass($class) { - $this->handlers['list_builder'] = $class; - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasListBuilderClass() { - return $this->hasHandlerClass('list_builder'); - } - - /** - * {@inheritdoc} - */ - public function getViewBuilderClass() { - return $this->getHandlerClass('view_builder'); - } - - /** - * {@inheritdoc} - */ - public function setViewBuilderClass($class) { - $this->handlers['view_builder'] = $class; - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasViewBuilderClass() { - return $this->hasHandlerClass('view_builder'); - } - - /** - * {@inheritdoc} - */ - public function getRouteProviderClasses() { - return !empty($this->handlers['route_provider']) ? $this->handlers['route_provider'] : []; - } - - /** - * {@inheritdoc} - */ - public function getAccessControlClass() { - return $this->getHandlerClass('access'); - } - - /** - * {@inheritdoc} - */ - public function setAccessClass($class) { - $this->handlers['access'] = $class; - return $this; - } - - /** - * {@inheritdoc} - */ - public function getAdminPermission() { - return $this->admin_permission ?: FALSE; - } - - /** - * {@inheritdoc} - */ - public function getPermissionGranularity() { - return $this->permission_granularity; - } - - /** - * {@inheritdoc} - */ - public function getLinkTemplates() { - return $this->links; - } - - /** - * {@inheritdoc} - */ - public function getLinkTemplate($key) { - $links = $this->getLinkTemplates(); - return isset($links[$key]) ? $links[$key] : FALSE; - } - - /** - * {@inheritdoc} - */ - public function hasLinkTemplate($key) { - $links = $this->getLinkTemplates(); - return isset($links[$key]); - } - - /** - * {@inheritdoc} - */ - public function setLinkTemplate($key, $path) { - if ($path[0] !== '/') { - throw new \InvalidArgumentException('Link templates accepts paths, which have to start with a leading slash.'); - } - - $this->links[$key] = $path; - return $this; - } - - /** - * {@inheritdoc} - */ - public function getLabelCallback() { - return $this->label_callback; - } - - /** - * {@inheritdoc} - */ - public function setLabelCallback($callback) { - $this->label_callback = $callback; - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasLabelCallback() { - return isset($this->label_callback); - } - - /** - * {@inheritdoc} - */ - public function getBundleEntityType() { - return $this->bundle_entity_type; - } - - /** - * {@inheritdoc} - */ - public function getBundleOf() { - return $this->bundle_of; - } - - /** - * {@inheritdoc} - */ - public function getBundleLabel() { - return (string) $this->bundle_label; - } - - /** - * {@inheritdoc} - */ - public function getBaseTable() { - return $this->base_table; - } - - /** - * {@inheritdoc} - */ - public function isTranslatable() { - return !empty($this->translatable); - } - - /** - * {@inheritdoc} - */ - public function isRevisionable() { - // Entity types are revisionable if a revision key has been specified. - return $this->hasKey('revision'); - } - - /** - * {@inheritdoc} - */ - public function getRevisionDataTable() { - return $this->revision_data_table; - } - - /** - * {@inheritdoc} - */ - public function getRevisionTable() { - return $this->revision_table; - } - - /** - * {@inheritdoc} - */ - public function getDataTable() { - return $this->data_table; - } - - /** - * {@inheritdoc} - */ - public function getLabel() { - return (string) $this->label; - } - - /** - * {@inheritdoc} - */ - public function getLowercaseLabel() { - return Unicode::strtolower($this->getLabel()); - } - - /** - * {@inheritdoc} - */ - public function getUriCallback() { - return $this->uri_callback; - } - - /** - * {@inheritdoc} - */ - public function setUriCallback($callback) { - $this->uri_callback = $callback; - return $this; - } - - /** - * {@inheritdoc} - */ - public function getGroup() { - return $this->group; - } - - - /** - * {@inheritdoc} - */ - public function getGroupLabel() { - return !empty($this->group_label) ? (string) $this->group_label : $this->t('Other', array(), array('context' => 'Entity type group')); - } - - /** - * {@inheritdoc} - */ - public function getListCacheContexts() { - return $this->list_cache_contexts; - } - - /** - * {@inheritdoc} - */ - public function getListCacheTags() { - return $this->list_cache_tags; - } - - /** - * {@inheritdoc} - */ - public function getConfigDependencyKey() { - // Return 'content' for the default implementation as important distinction - // is that dependencies on other configuration entities are hard - // dependencies and have to exist before creating the dependent entity. - return 'content'; - } - - /** - * {@inheritdoc} - */ - public function isCommonReferenceTarget() { - return $this->common_reference_target; - } - - /** - * {@inheritdoc} - */ - public function getConstraints() { - return $this->constraints; - } - - /** - * {@inheritdoc} - */ - public function setConstraints(array $constraints) { - $this->constraints = $constraints; - return $this; - } - - /** - * {@inheritdoc} - */ - public function addConstraint($constraint_name, $options = NULL) { - $this->constraints[$constraint_name] = $options; - return $this; - } - - /** - * {@inheritdoc} - */ - public function getBundleConfigDependency($bundle) { - // If this entity type uses entities to manage its bundles then depend on - // the bundle entity. - if ($bundle_entity_type_id = $this->getBundleEntityType()) { - if (!$bundle_entity = \Drupal::entityManager()->getStorage($bundle_entity_type_id)->load($bundle)) { - throw new \LogicException(sprintf('Missing bundle entity, entity type %s, entity id %s.', $bundle_entity_type_id, $bundle)); - } - $config_dependency = [ - 'type' => 'config', - 'name' => $bundle_entity->getConfigDependencyName(), - ]; - } - else { - // Depend on the provider of the entity type. - $config_dependency = [ - 'type' => 'module', - 'name' => $this->getProvider(), - ]; - } - - return $config_dependency; - } - -} diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index 53155a0..6968147 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -44,7 +44,6 @@ * admin_permission = "administer users", * base_table = "users", * data_table = "users_field_data", - * label_callback = "user_format_name", * translatable = TRUE, * entity_keys = { * "id" = "uid",