public function FieldBlock::calculateDependencies in Field as Block 8.2
Overrides BlockPluginTrait::calculateDependencies
See also
\Drupal\views\Plugin\views\field\Field::calculateDependencies()
File
- src/
Plugin/ Block/ FieldBlock.php, line 348
Class
- FieldBlock
- Provides a fieldblock.
Namespace
Drupal\fieldblock\Plugin\BlockCode
public function calculateDependencies() {
$dependencies = parent::calculateDependencies();
// Add the module providing the configured field storage as a dependency.
if (($field_storage_definition = $this
->getFieldStorageDefinition($this->configuration['field_name'])) && $field_storage_definition instanceof EntityInterface) {
$dependencies['config'][] = $field_storage_definition
->getConfigDependencyName();
}
// Add the module providing the formatter.
if (!empty($this->configuration['formatter_id'])) {
$dependencies['module'][] = $this->formatterPluginManager
->getDefinition($this->configuration['formatter_id'])['provider'];
}
return $dependencies;
}