ParagraphBlocksEntity.php in Paragraph blocks 8.2
File
src/Entity/ParagraphBlocksEntity.php
View source
<?php
namespace Drupal\paragraph_blocks\Entity;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\paragraphs\Entity\Paragraph;
class ParagraphBlocksEntity extends Paragraph {
use StringTranslationTrait;
public function getSummary(array $options = []) {
$value = $this->admin_title
->getValue();
foreach ($this
->getFieldDefinitions() as $field_name => $field_definition) {
if (strpos($field_name, 'title') !== FALSE) {
$text = $this
->getTextSummary($field_name, $field_definition);
if (!empty($text)) {
return $text;
}
}
}
return parent::getSummary($options);
}
}