You are here

protected function ContentProcessor::processSectionField in GatherContent 8.4

Processing function for section type of field.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Object of node.

\Drupal\field\Entity\FieldConfig $field_info: Local field Info object.

bool $is_translatable: Indicator if node is translatable.

string $language: Language of translation if applicable.

object $field: Object with field attributes.

string $text_format: Text format string.

string $parent_field_type: Parent field type string to pass through field type in case of reference fields.

1 call to ContentProcessor::processSectionField()
ContentProcessor::processContentPane in src/Import/ContentProcess/ContentProcessor.php
Processing function for content panes.

File

src/Import/ContentProcess/ContentProcessor.php, line 491

Class

ContentProcessor
The ContentProcessor sets the necessary fields of the entity.

Namespace

Drupal\gathercontent\Import\ContentProcess

Code

protected function processSectionField(EntityInterface &$entity, FieldConfig $field_info, $is_translatable, $language, $field, $text_format, $parent_field_type = '') {
  $local_field_name = $field_info
    ->getName();
  $target =& $entity;
  if ($is_translatable) {
    $target = $entity
      ->getTranslation($language);
  }
  $id = $language . $field_info
    ->id();
  if (!isset($this->concatFieldValues[$id]) || $parent_field_type === 'entity_reference_revisions') {
    $this->concatFieldValues[$id] = '';
  }
  $this->concatFieldValues[$id] .= '<h3>' . $field->title . '</h3>' . $field->subtitle;
  $target->{$local_field_name} = [
    'value' => $this->concatFieldValues[$id],
    'format' => !empty($text_format) ? $text_format : 'basic_html',
  ];
}