You are here

public function Paragraphs::getSummary in Paragraphs 8

Returns the summary for a target.

Returning the summary as array is encouraged. The allowance of returning a string only exists for backwards compatibility.

Return value

string|string[] The configuration summary.

Overrides Text::getSummary

File

src/Feeds/Target/Paragraphs.php, line 106

Class

Paragraphs
Feeds target plugin for Paragraphs fields.

Namespace

Drupal\paragraphs\Feeds\Target

Code

public function getSummary() {
  $summary = $this
    ->t('Not yet configured.');
  $paragraphs_type_id = $this->configuration['paragraphs_type'];
  $paragraph_field_name = $this->configuration['paragraph_field'];
  if ($paragraphs_type_id && ($paragraphs_type = $this->paragraphsTypeStorage
    ->load($paragraphs_type_id))) {
    if ($paragraph_field_name && ($paragraph_field = $this->fieldConfigStorage
      ->load('paragraph.' . $paragraphs_type_id . '.' . $paragraph_field_name))) {
      $summary = $this
        ->t('Using the %field field on a %type paragraph.', [
        '%field' => $paragraph_field
          ->label(),
        '%type' => $paragraphs_type
          ->label(),
      ]);
    }
  }
  return $summary . '<br>' . parent::getSummary();
}