Drupal 8  8.0.2
BlockContentBlock Class Reference
Inheritance diagram for BlockContentBlock:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, BlockManagerInterface $block_manager, EntityManagerInterface $entity_manager, AccountInterface $account, UrlGeneratorInterface $url_generator)
 
 defaultConfiguration ()
 
 blockForm ($form, FormStateInterface $form_state)
 
 blockSubmit ($form, FormStateInterface $form_state)
 
 build ()
 
- Public Member Functions inherited from BlockBase
 label ()
 
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 getConfiguration ()
 
 setConfiguration (array $configuration)
 
 defaultConfiguration ()
 
 setConfigurationValue ($key, $value)
 
 calculateDependencies ()
 
 access (AccountInterface $account, $return_as_object=FALSE)
 
 buildConfigurationForm (array $form, FormStateInterface $form_state)
 
 blockForm ($form, FormStateInterface $form_state)
 
 validateConfigurationForm (array &$form, FormStateInterface $form_state)
 
 blockValidate ($form, FormStateInterface $form_state)
 
 submitConfigurationForm (array &$form, FormStateInterface $form_state)
 
 blockSubmit ($form, FormStateInterface $form_state)
 
 getMachineNameSuggestion ()
 
 setTransliteration (TransliterationInterface $transliteration)
 
- Public Member Functions inherited from ContextAwarePluginBase
 getContext ($name)
 
 setContext ($name, ComponentContextInterface $context)
 
 setContextValue ($name, $value)
 
 getContextMapping ()
 
 setContextMapping (array $context_mapping)
 
 getContextDefinitions ()
 
 getContextDefinition ($name)
 
- Public Member Functions inherited from ContextAwarePluginBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 getContextDefinitions ()
 
 getContextDefinition ($name)
 
 getContexts ()
 
 getContext ($name)
 
 setContext ($name, ContextInterface $context)
 
 getContextValues ()
 
 getContextValue ($name)
 
 setContextValue ($name, $value)
 
 validateContexts ()
 
- Public Member Functions inherited from PluginBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 getPluginId ()
 
 getBaseId ()
 
 getDerivativeId ()
 
 getPluginDefinition ()
 
- Public Member Functions inherited from CacheableDependencyInterface
 getCacheContexts ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Protected Member Functions

 blockAccess (AccountInterface $account)
 
 getEntity ()
 
- Protected Member Functions inherited from BlockBase
 baseConfigurationDefaults ()
 
 blockAccess (AccountInterface $account)
 
 transliteration ()
 
- Protected Member Functions inherited from ContextAwarePluginBase
 createContextFromConfiguration (array $context_configuration)
 
 contextHandler ()
 
- Protected Member Functions inherited from ContextAwarePluginBase
 createContextFromConfiguration (array $context_configuration)
 

Protected Attributes

 $blockManager
 
 $entityManager
 
 $account
 
 $blockContent
 
 $urlGenerator
 
- Protected Attributes inherited from BlockBase
 $transliteration
 
- Protected Attributes inherited from ContextAwarePluginBase
 $context = []
 
- Protected Attributes inherited from PluginBase
 $pluginId
 
 $pluginDefinition
 
 $configuration
 

Additional Inherited Members

- Data Fields inherited from PluginBase
const DERIVATIVE_SEPARATOR = ':'
 

Detailed Description

Defines a generic custom block type.

( id = "block_content", admin_label = ("Custom block"), category = ("Custom"), deriver = "Drupal\block_content\Plugin\Derivative\BlockContent" )

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
BlockManagerInterface  $block_manager,
EntityManagerInterface  $entity_manager,
AccountInterface  $account,
UrlGeneratorInterface  $url_generator 
)

Constructs a new BlockContentBlock.

Parameters
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
\Drupal\Core\Block\BlockManagerInterface$block_managerThe Plugin Block Manager.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager service.
\Drupal\Core\Session\AccountInterface$accountThe account for which view access should be checked.
\Drupal\Core\Routing\UrlGeneratorInterface$url_generatorThe URL generator.

References Drupal\entityManager(), and Drupal\urlGenerator().

Here is the call graph for this function:

Member Function Documentation

blockAccess ( AccountInterface  $account)
protected

{}

References AccessResult\forbidden(), and BlockContentBlock\getEntity().

Here is the call graph for this function:

blockForm (   $form,
FormStateInterface  $form_state 
)

Overrides ::blockForm().

Adds body and description fields to the block configuration form.

Implements BlockPluginInterface.

References Drupal\entityManager(), DerivativeInspectionInterface\getDerivativeId(), and t().

Here is the call graph for this function:

blockSubmit (   $form,
FormStateInterface  $form_state 
)

{Adds block type-specific submission handling for the block form.Note that this method takes the form structure and form state for the full block configuration form as arguments, not just the elements defined in BlockPluginInterface::blockForm().

Parameters
array$formThe form definition array for the full block configuration form.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
See Also
::blockForm()
::blockValidate()
}

Implements BlockPluginInterface.

References FormStateInterface\getValue().

Here is the call graph for this function:

build ( )

{Builds and returns the renderable array for this block plugin.If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with cache set (with cacheability metadata indicating the circumstances for it being empty).

Returns
array A renderable array representing the content of the block.
See Also
}

Implements BlockPluginInterface.

References Drupal\entityManager(), DerivativeInspectionInterface\getDerivativeId(), BlockContentBlock\getEntity(), t(), and Drupal\urlGenerator().

Here is the call graph for this function:

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

defaultConfiguration ( )

{Gets default configuration for this plugin.

Returns
array An associative array with the default configuration.
}

Implements ConfigurablePluginInterface.

getEntity ( )
protected

Loads the block content entity of the block.

Returns
|null The block content entity.

References Drupal\entityManager(), and DerivativeInspectionInterface\getDerivativeId().

Referenced by BlockContentBlock\blockAccess(), and BlockContentBlock\build().

Here is the call graph for this function:

Here is the caller graph for this function:


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