You are here

public function WrapperTarget::getSummary in Feeds 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 FieldTargetBase::getSummary

File

src/Feeds/Target/WrapperTarget.php, line 280

Class

WrapperTarget
Defines a wrapper target around a paragraph bundle's target field.

Namespace

Drupal\feeds_para_mapper\Feeds\Target

Code

public function getSummary() {
  $mapper = $this
    ->getMapper();
  $sum = null;
  if ($this->targetInstance instanceof ConfigurableTargetInterface) {
    $sum = $this->targetInstance
      ->getSummary();
  }
  $has_settings = $mapper
    ->getInfo($this->field, 'has_settings');
  $final_str = $sum;
  if ($has_settings) {
    $temp_sum = "Maximum values: " . $this->configuration['max_values'];
    if (isset($sum) && $sum instanceof TranslatableMarkup) {
      $final_str = $sum
        ->getUntranslatedString();
      $final_str .= "<br>" . $temp_sum;
      $args = $sum
        ->getArguments();
      if (isset($args)) {
        $final_str = $this
          ->t($final_str, $args);
      }
      else {
        $final_str = $this
          ->t($final_str);
      }
    }
    else {
      $final_str = $sum . "<br>" . $this
        ->t($temp_sum);
    }
  }
  return $final_str;
}