Skip to content
Snippets Groups Projects
Commit 2d03e83a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2302235 by lokeoke, er.pushpinderrana, tim.plunkett | Crell: Set...

Issue #2302235 by lokeoke, er.pushpinderrana, tim.plunkett | Crell: Set default property values in EntityType.
parent 1e61d83a
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -26,21 +26,21 @@ class EntityType implements EntityTypeInterface {
*
* @var bool
*/
protected $static_cache;
protected $static_cache = TRUE;
/**
* Indicates whether the rendered output of entities should be cached.
*
* @var bool
*/
protected $render_cache;
protected $render_cache = TRUE;
/**
* Indicates if the persistent cache of field data should be used.
*
* @var bool
*/
protected $persistent_cache;
protected $persistent_cache = TRUE;
/**
* An array of entity keys.
......@@ -96,18 +96,18 @@ class EntityType implements EntityTypeInterface {
/**
* The permission granularity level.
*
* The allowed values are respectively "entity_type", "bundle" or FALSE.
* The allowed values are respectively "entity_type" or "bundle".
*
* @var string|bool
* @var string
*/
protected $permission_granularity;
protected $permission_granularity = 'entity_type';
/**
* Indicates whether fields can be attached to entities of this type.
*
* @var bool (optional)
* @var bool
*/
protected $fieldable;
protected $fieldable = FALSE;
/**
* Link templates using the URI template syntax.
......@@ -119,58 +119,58 @@ class EntityType implements EntityTypeInterface {
/**
* The name of a callback that returns the label of the entity.
*
* @var string
* @var string|null
*/
protected $label_callback;
protected $label_callback = NULL;
/**
* The name of the entity type which provides bundles.
*
* @var string
*/
protected $bundle_entity_type;
protected $bundle_entity_type = 'bundle';
/**
* The name of the entity type for which bundles are provided.
*
* @var string
* @var string|null
*/
protected $bundle_of;
protected $bundle_of = NULL;
/**
* The human-readable name of the entity bundles, e.g. Vocabulary.
*
* @var string
* @var string|null
*/
protected $bundle_label;
protected $bundle_label = NULL;
/**
* The name of the entity type's base table.
*
* @var string
* @var string|null
*/
protected $base_table;
protected $base_table = NULL;
/**
* The name of the entity type's revision data table.
*
* @var string
* @var string|null
*/
protected $revision_data_table;
protected $revision_data_table = NULL;
/**
* The name of the entity type's revision table.
*
* @var string
* @var string|null
*/
protected $revision_table;
protected $revision_table = NULL;
/**
* The name of the entity type's data table.
*
* @var string
* @var string|null
*/
protected $data_table;
protected $data_table = NULL;
/**
* Indicates whether entities of this type have multilingual support.
......@@ -184,14 +184,14 @@ class EntityType implements EntityTypeInterface {
*
* @var string
*/
protected $label;
protected $label = '';
/**
* A callable that can be used to provide the entity URI.
*
* @var callable
* @var callable|null
*/
protected $uri_callback;
protected $uri_callback = NULL;
/**
* The machine name of the entity type group.
......@@ -256,21 +256,21 @@ public function set($property, $value) {
* {@inheritdoc}
*/
public function isStaticallyCacheable() {
return isset($this->static_cache) ? $this->static_cache: TRUE;
return $this->static_cache;
}
/**
* {@inheritdoc}
*/
public function isRenderCacheable() {
return isset($this->render_cache) ? $this->render_cache: TRUE;
return $this->render_cache;
}
/**
* {@inheritdoc}
*/
public function isPersistentlyCacheable() {
return isset($this->persistent_cache) ? $this->persistent_cache: TRUE;
return $this->persistent_cache;
}
/**
......@@ -490,21 +490,21 @@ public function getAdminPermission() {
* {@inheritdoc}
*/
public function getPermissionGranularity() {
return isset($this->permission_granularity) ? $this->permission_granularity : 'entity_type';
return $this->permission_granularity;
}
/**
* {@inheritdoc}
*/
public function isFieldable() {
return isset($this->fieldable) ? $this->fieldable : FALSE;
return $this->fieldable;
}
/**
* {@inheritdoc}
*/
public function getLinkTemplates() {
return isset($this->links) ? $this->links : array();
return $this->links;
}
/**
......@@ -535,7 +535,7 @@ public function setLinkTemplate($key, $route_name) {
* {@inheritdoc}
*/
public function getLabelCallback() {
return isset($this->label_callback) ? $this->label_callback : FALSE;
return $this->label_callback;
}
/**
......@@ -557,28 +557,28 @@ public function hasLabelCallback() {
* {@inheritdoc}
*/
public function getBundleEntityType() {
return isset($this->bundle_entity_type) ? $this->bundle_entity_type : 'bundle';
return $this->bundle_entity_type;
}
/**
* {@inheritdoc}
*/
public function getBundleOf() {
return isset($this->bundle_of) ? $this->bundle_of : FALSE;
return $this->bundle_of;
}
/**
* {@inheritdoc}
*/
public function getBundleLabel() {
return isset($this->bundle_label) ? $this->bundle_label : FALSE;
return $this->bundle_label;
}
/**
* {@inheritdoc}
*/
public function getBaseTable() {
return isset($this->base_table) ? $this->base_table : FALSE;
return $this->base_table;
}
/**
......@@ -607,28 +607,28 @@ public function getConfigPrefix() {
* {@inheritdoc}
*/
public function getRevisionDataTable() {
return isset($this->revision_data_table) ? $this->revision_data_table : FALSE;
return $this->revision_data_table;
}
/**
* {@inheritdoc}
*/
public function getRevisionTable() {
return isset($this->revision_table) ? $this->revision_table : FALSE;
return $this->revision_table;
}
/**
* {@inheritdoc}
*/
public function getDataTable() {
return isset($this->data_table) ? $this->data_table : FALSE;
return $this->data_table;
}
/**
* {@inheritdoc}
*/
public function getLabel() {
return isset($this->label) ? $this->label : '';
return $this->label;
}
/**
......@@ -642,7 +642,7 @@ public function getLowercaseLabel() {
* {@inheritdoc}
*/
public function getUriCallback() {
return isset($this->uri_callback) ? $this->uri_callback : FALSE;
return $this->uri_callback;
}
/**
......
......@@ -387,12 +387,11 @@ public function getAdminPermission();
/**
* Returns the permission granularity level.
*
* The allowed values are respectively "entity_type", "bundle" or FALSE.
* The allowed values are respectively "entity_type" or "bundle".
*
* @return string|bool
* @return string
* Whether a module exposing permissions for the current entity type
* should use entity-type level granularity, bundle level granularity or
* just skip this entity.
* should use entity-type level granularity or bundle level granularity.
*/
public function getPermissionGranularity();
......@@ -483,8 +482,8 @@ public function setLinkTemplate($key, $route_name);
* \Drupal\Core\Entity\EntityInterface::label() method, which implements this
* logic.
*
* @return callable|bool
* The callback, or FALSE if none exists.
* @return callable|null
* The callback, or NULL if none exists.
*/
public function getLabelCallback();
......@@ -519,8 +518,8 @@ public function getBundleEntityType();
* the Field UI module uses it to add operation links to manage fields and
* displays.
*
* @return string|bool
* The entity type for which this entity provides bundles, or FALSE if does
* @return string|null
* The entity type for which this entity provides bundles, or NULL if does
* not provide bundles for another entity type.
*/
public function getBundleOf();
......@@ -528,8 +527,8 @@ public function getBundleOf();
/**
* Returns the label for the bundle.
*
* @return string|bool
* The bundle label, or FALSE if none exists.
* @return string|null
* The bundle label, or NULL if none exists.
*/
public function getBundleLabel();
......@@ -538,8 +537,8 @@ public function getBundleLabel();
*
* @todo Used by ContentEntityDatabaseStorage only.
*
* @return string|bool
* The name of the entity's base table, or FALSE if none exists.
* @return string|null
* The name of the entity's base table, or NULL if none exists.
*/
public function getBaseTable();
......@@ -575,8 +574,9 @@ public function getConfigPrefix();
*
* @todo Used by ContentEntityDatabaseStorage only.
*
* @return string|bool
* The name of the entity type's revision data table.
* @return string|null
* The name of the entity type's revision data table, or NULL if none
* exists.
*/
public function getRevisionDataTable();
......@@ -585,8 +585,8 @@ public function getRevisionDataTable();
*
* @todo Used by ContentEntityDatabaseStorage only.
*
* @return string|bool
* The name of the entity type's revision table.
* @return string|null
* The name of the entity type's revision table, or NULL if none exists.
*/
public function getRevisionTable();
......@@ -595,8 +595,8 @@ public function getRevisionTable();
*
* @todo Used by ContentEntityDatabaseStorage only.
*
* @return string|bool
* The name of the entity type's data table.
* @return string|null
* The name of the entity type's data table, or NULL if none exists.
*/
public function getDataTable();
......@@ -622,8 +622,8 @@ public function getLowercaseLabel();
* This is only called if there is no matching link template for the link
* relationship type, and there is no bundle-specific callback provided.
*
* @return callable|bool
* A valid callback that is passed the entity or FALSE if none is specified.
* @return callable|null
* A valid callback that is passed the entity or NULL if none is specified.
*/
public function getUriCallback();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment