function InlineBlockEntityOperations::saveInlineBlockComponent
Same name in other branches
- 9 core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::saveInlineBlockComponent()
- 8.9.x core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::saveInlineBlockComponent()
- 11.x core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::saveInlineBlockComponent()
Saves an inline block component.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity with the layout.
\Drupal\layout_builder\SectionComponent $component: The section component with an inline block.
bool $new_revision: Whether a new revision of the block should be created when modified.
bool $duplicate_blocks: Whether the blocks should be duplicated.
1 call to InlineBlockEntityOperations::saveInlineBlockComponent()
- InlineBlockEntityOperations::handlePreSave in core/
modules/ layout_builder/ src/ InlineBlockEntityOperations.php - Handles saving a parent entity.
File
-
core/
modules/ layout_builder/ src/ InlineBlockEntityOperations.php, line 229
Class
- InlineBlockEntityOperations
- Defines a class for reacting to entity events related to Inline Blocks.
Namespace
Drupal\layout_builderCode
protected function saveInlineBlockComponent(EntityInterface $entity, SectionComponent $component, $new_revision, $duplicate_blocks) {
/** @var \Drupal\layout_builder\Plugin\Block\InlineBlock $plugin */
$plugin = $component->getPlugin();
$pre_save_configuration = $plugin->getConfiguration();
$plugin->saveBlockContent($new_revision, $duplicate_blocks);
$post_save_configuration = $plugin->getConfiguration();
if ($duplicate_blocks || empty($pre_save_configuration['block_revision_id']) && !empty($post_save_configuration['block_revision_id'])) {
$this->usage
->addUsage($post_save_configuration['block_id'], $entity);
}
$component->setConfiguration($post_save_configuration);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.