Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InlineBlockEntityOperations.php

function 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_builder

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal