You are here

class ParagraphBlocksEntity in Paragraph blocks 3.x

Same name and namespace in other branches
  1. 8.2 src/Entity/ParagraphBlocksEntity.php \Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity
  2. 8 src/Entity/ParagraphBlocksEntity.php \Drupal\paragraph_blocks\Entity\ParagraphBlocksEntity

Extend the Paragraph entity.

Hierarchy

Expanded class hierarchy of ParagraphBlocksEntity

1 file declares its use of ParagraphBlocksEntity
paragraph_blocks.module in ./paragraph_blocks.module
Contains paragraph_blocks.module.

File

src/Entity/ParagraphBlocksEntity.php, line 11

Namespace

Drupal\paragraph_blocks\Entity
View source
class ParagraphBlocksEntity extends Paragraph {
  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public function getSummary(array $options = []) {

    // Get any field with title in the name.
    $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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParagraphBlocksEntity::getSummary public function
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.