You are here

class FieldMappingProcessor in Gutenberg 8.2

Processor removing blocks with a "mappingFields" attribute.

Hierarchy

Expanded class hierarchy of FieldMappingProcessor

1 string reference to 'FieldMappingProcessor'
gutenberg.services.yml in ./gutenberg.services.yml
gutenberg.services.yml
1 service uses FieldMappingProcessor
gutenberg.block_processor_field_mapping in ./gutenberg.services.yml
Drupal\gutenberg\BlockProcessor\FieldMappingProcessor

File

src/BlockProcessor/FieldMappingProcessor.php, line 10

Namespace

Drupal\gutenberg\BlockProcessor
View source
class FieldMappingProcessor implements GutenbergBlockProcessorInterface {

  /**
   * {@inheritdoc}
   */
  public function processBlock(array &$block, &$block_content, RefinableCacheableDependencyInterface $bubbleable_metadata) {

    // Remove the inner content since the contents of this block will be mapped
    // to an entity field.
    $block_content = '';

    // Stop further processing by returning FALSE?
    // Shouldn't have to if it's of a low enough weight.
  }

  /**
   * {@inheritdoc}
   */
  public function isSupported(array $block, $block_content = '') {
    return !empty($block['attrs']['mappingFields']) && is_array($block['attrs']['mappingFields']);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FieldMappingProcessor::isSupported public function Whether the processor supports this block instance. Overrides GutenbergBlockProcessorInterface::isSupported
FieldMappingProcessor::processBlock public function Process the Gutenberg block and its content. Overrides GutenbergBlockProcessorInterface::processBlock