Drupal 8  8.0.2
BlockContent Class Reference
Inheritance diagram for BlockContent:

Public Member Functions

 createDuplicate ()
 
 setTheme ($theme)
 
 getTheme ()
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 getInstances ()
 
 preSaveRevision (EntityStorageInterface $storage,\stdClass $record)
 
 delete ()
 
 getRevisionLog ()
 
 setInfo ($info)
 
 setRevisionLog ($revision_log)
 
- Public Member Functions inherited from ContentEntityBase
 __construct (array $values, $entity_type, $bundle=FALSE, $translations=array())
 
 postCreate (EntityStorageInterface $storage)
 
 setNewRevision ($value=TRUE)
 
 isNewRevision ()
 
 isDefaultRevision ($new_value=NULL)
 
 isRevisionTranslationAffected ()
 
 setRevisionTranslationAffected ($affected)
 
 isDefaultTranslation ()
 
 getRevisionId ()
 
 isTranslatable ()
 
 preSave (EntityStorageInterface $storage)
 
 preSaveRevision (EntityStorageInterface $storage,\stdClass $record)
 
 validate ()
 
 isValidationRequired ()
 
 setValidationRequired ($required)
 
 __sleep ()
 
 id ()
 
 bundle ()
 
 uuid ()
 
 hasField ($field_name)
 
 get ($field_name)
 
 set ($name, $value, $notify=TRUE)
 
 getFields ($include_computed=TRUE)
 
 getTranslatableFields ($include_computed=TRUE)
 
 getIterator ()
 
 getFieldDefinition ($name)
 
 getFieldDefinitions ()
 
 toArray ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 onChange ($name)
 
 getTranslation ($langcode)
 
 getUntranslated ()
 
 hasTranslation ($langcode)
 
 isNewTranslation ()
 
 removeTranslation ($langcode)
 
 getTranslationLanguages ($include_default=TRUE)
 
 updateOriginalValues ()
 
__get ($name)
 
 __set ($name, $value)
 
 __isset ($name)
 
 __unset ($name)
 
 createDuplicate ()
 
 __clone ()
 
 label ()
 
 referencedEntities ()
 
- Public Member Functions inherited from Entity
 __construct (array $values, $entity_type)
 
 id ()
 
 uuid ()
 
 isNew ()
 
 enforceIsNew ($value=TRUE)
 
 getEntityTypeId ()
 
 bundle ()
 
 label ()
 
 urlInfo ($rel= 'canonical', array $options=[])
 
 toUrl ($rel= 'canonical', array $options=[])
 
 hasLinkTemplate ($rel)
 
 link ($text=NULL, $rel= 'canonical', array $options=[])
 
 toLink ($text=NULL, $rel= 'canonical', array $options=[])
 
 url ($rel= 'canonical', $options=array())
 
 uriRelationships ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 save ()
 
 delete ()
 
 createDuplicate ()
 
 getEntityType ()
 
 preSave (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 postCreate (EntityStorageInterface $storage)
 
 referencedEntities ()
 
 getCacheContexts ()
 
 getCacheTagsToInvalidate ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 toArray ()
 
 getTypedData ()
 
 __sleep ()
 
 getConfigDependencyKey ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
- Public Member Functions inherited from RefinableCacheableDependencyInterface
 addCacheContexts (array $cache_contexts)
 
 addCacheTags (array $cache_tags)
 
 mergeCacheMaxAge ($max_age)
 
 addCacheableDependency ($other_object)
 
- Public Member Functions inherited from ContentEntityInterface
 hasTranslationChanges ()
 
- Public Member Functions inherited from TranslatableInterface
 addTranslation ($langcode, array $values=array())
 
- Public Member Functions inherited from EntityChangedInterface
 getChangedTime ()
 
 setChangedTime ($timestamp)
 
 getChangedTimeAcrossTranslations ()
 

Static Public Member Functions

static baseFieldDefinitions (EntityTypeInterface $entity_type)
 
- Static Public Member Functions inherited from ContentEntityBase
static bundleFieldDefinitions (EntityTypeInterface $entity_type, $bundle, array $base_field_definitions)
 
- Static Public Member Functions inherited from Entity
static preCreate (EntityStorageInterface $storage, array &$values)
 
static preDelete (EntityStorageInterface $storage, array $entities)
 
static postDelete (EntityStorageInterface $storage, array $entities)
 
static postLoad (EntityStorageInterface $storage, array &$entities)
 
static load ($id)
 
static loadMultiple (array $ids=NULL)
 
static create (array $values=array())
 

Protected Attributes

 $theme
 
- Protected Attributes inherited from ContentEntityBase
 $values = array()
 
 $fields = array()
 
 $fieldDefinitions
 
 $languages
 
 $langcodeKey
 
 $defaultLangcodeKey
 
 $activeLangcode = LanguageInterface::LANGCODE_DEFAULT
 
 $defaultLangcode
 
 $translations = array()
 
 $translationInitialize = FALSE
 
 $newRevision = FALSE
 
 $isDefaultRevision = TRUE
 
 $entityKeys = array()
 
 $translatableEntityKeys = array()
 
 $validated = FALSE
 
 $validationRequired = FALSE
 
- Protected Attributes inherited from Entity
 $entityTypeId
 
 $enforceIsNew
 
 $typedData
 

Additional Inherited Members

- Data Fields inherited from ContentEntityBase
const TRANSLATION_REMOVED = 0
 
const TRANSLATION_EXISTING = 1
 
const TRANSLATION_CREATED = 2
 
- Protected Member Functions inherited from ContentEntityBase
 getLanguages ()
 
 clearTranslationCache ()
 
 getTranslatedField ($name, $langcode)
 
 setDefaultLangcode ()
 
 updateFieldLangcodes ($langcode)
 
 initializeTranslation ($langcode)
 
 getEntityKey ($key)
 
- Protected Member Functions inherited from Entity
 entityManager ()
 
 entityTypeManager ()
 
 languageManager ()
 
 uuidGenerator ()
 
 linkTemplates ()
 
 urlRouteParameters ($rel)
 
 invalidateTagsOnSave ($update)
 
- Static Protected Member Functions inherited from Entity
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 

Detailed Description

Defines the custom block entity class.

( id = "block_content", label = ("Custom block"), bundle_label = ("Custom block type"), handlers = { "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage", "access" = "Drupal\block_content\BlockContentAccessControlHandler", "list_builder" = "Drupal\block_content\BlockContentListBuilder", "view_builder" = "Drupal\block_content\BlockContentViewBuilder", "views_data" = "Drupal\block_content\BlockContentViewsData", "form" = { "add" = "Drupal\block_content\BlockContentForm", "edit" = "Drupal\block_content\BlockContentForm", "delete" = "Drupal\block_content\Form\BlockContentDeleteForm", "default" = "Drupal\block_content\BlockContentForm" }, "translation" = "Drupal\block_content\BlockContentTranslationHandler" }, admin_permission = "administer blocks", base_table = "block_content", revision_table = "block_content_revision", data_table = "block_content_field_data", links = { "canonical" = "/block/{block_content}", "delete-form" = "/block/{block_content}/delete", "edit-form" = "/block/{block_content}", "collection" = "/admin/structure/block/block-content", }, translatable = TRUE, entity_keys = { "id" = "id", "revision" = "revision_id", "bundle" = "type", "label" = "info", "langcode" = "langcode", "uuid" = "uuid" }, bundle_entity_type = "block_content_type", field_ui_base_route = "entity.block_content_type.edit_form", render_cache = FALSE, )

Note that render caching of block_content entities is disabled because they are always rendered as blocks, and blocks already have their own render caching. See https://www.drupal.org/node/2284917#comment-9132521 for more information.

Member Function Documentation

static baseFieldDefinitions ( EntityTypeInterface  $entity_type)
static

{Provides base field definitions for an entity type.Implementations typically use the class for creating the field definitions; for example a 'name' field could be defined as the following:

$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'));
By definition, base fields are fields that exist for every bundle. To provide definitions for fields that should only exist on some bundles, use ::bundleFieldDefinitions().The definitions returned by this function can be overridden for all bundles by hook_entity_base_field_info_alter() or overridden on a per-bundle basis via 'base_field_override' configuration entities.
Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition. Useful when a single class is used for multiple, possibly dynamic entity types.
Returns
[] An array of base field definitions for the entity type, keyed by field name.
See Also
::getFieldDefinitions()
::bundleFieldDefinitions()
}

Implements FieldableEntityInterface.

References BaseFieldDefinition\create(), and t().

Here is the call graph for this function:

createDuplicate ( )

{Creates a duplicate of the entity.

Returns
static A clone of $this with all identifiers unset, so saving it inserts a new entity into the storage system.
}

Implements EntityInterface.

delete ( )

{Deletes an entity permanently.

Exceptions
\Drupal\Core\Entity\EntityStorageExceptionIn case of failures an exception is thrown.
}

Implements EntityInterface.

References BlockContent\getInstances().

Here is the call graph for this function:

getInstances ( )

{Gets the configured instances of this custom block.

Returns
array Array of Drupal entities.
}

Implements BlockContentInterface.

References ContentEntityBase\uuid().

Referenced by BlockContent\delete().

Here is the call graph for this function:

Here is the caller graph for this function:

getRevisionLog ( )

{Returns the block revision log message.

Returns
string The revision log message.
}

Implements BlockContentInterface.

getTheme ( )

{Gets the theme value.When creating a new block content block from the block library, the user is redirected to the configure form for that block in the given theme. The theme is stored against the block when the block content add form is shown.

Returns
string The theme name.
}

Implements BlockContentInterface.

postSave ( EntityStorageInterface  $storage,
  $update = TRUE 
)

{Acts on a saved entity before the insert or update hook is invoked.Used after the entity is saved, but before invoking the insert or update hook. Note that in case of translatable content entities this callback is only fired on their current translation. It is up to the developer to iterate over all translations if needed.

Parameters
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage object.
bool$updateTRUE if the entity has been updated, or FALSE if it has been inserted.
}

Implements EntityInterface.

References Drupal\service().

Here is the call graph for this function:

preSaveRevision ( EntityStorageInterface  $storage,
\stdClass  $record 
)

{Acts on a revision before it gets saved.

Parameters
EntityStorageInterface$storageThe entity storage object.
\stdClass$recordThe revision object.
}

Implements RevisionableInterface.

References ContentEntityBase\isNewRevision().

Here is the call graph for this function:

setInfo (   $info)

{Sets the block description.

Parameters
string$infoThe block description.
Returns
The class instance that this method is called on.
}

Implements BlockContentInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setRevisionLog (   $revision_log)

{Sets the block revision log message.

Parameters
string$revision_logThe revision log message.
Returns
The class instance that this method is called on.
}

Implements BlockContentInterface.

References ContentEntityBase\set().

Here is the call graph for this function:

setTheme (   $theme)

{Sets the theme value.When creating a new block content block from the block library, the user is redirected to the configure form for that block in the given theme. The theme is stored against the block when the block content add form is shown.

Parameters
string$themeThe theme name.
Returns
The class instance that this method is called on.
}

Implements BlockContentInterface.

References Drupal\theme().

Here is the call graph for this function:


The documentation for this class was generated from the following file: