You are here

class Text in Views TimelineJS integration 8.3

Defines a TimelineJS3 text object.

Hierarchy

Expanded class hierarchy of Text

1 file declares its use of Text
TimelineJS.php in src/Plugin/views/style/TimelineJS.php

File

src/TimelineJS/Text.php, line 8

Namespace

Drupal\views_timelinejs\TimelineJS
View source
class Text implements TextInterface {

  /**
   * The text object headline.
   *
   * @var string
   */
  protected $headline;

  /**
   * The text object text.
   *
   * Yes, this property's name is terribly ambiguous.
   *
   * @var string
   */
  protected $text;

  /**
   * Constructs a new Text object.
   *
   * @param string $headline
   *   The title of the text resource.
   * @param string $text
   *   The body of the text resource.
   */
  public function __construct($headline = '', $text = '') {
    $this->headline = $headline;
    $this->text = $text;
  }

  /**
   * {@inheritdoc}
   */
  public function buildArray() {
    $text = [];
    if (!empty($this->headline)) {
      $text['headline'] = $this->headline;
    }
    if (!empty($this->text)) {
      $text['text'] = $this->text;
    }
    return $text;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Text::$headline protected property The text object headline.
Text::$text protected property The text object text.
Text::buildArray public function Creates an array representing the TimelineJS javascript object. Overrides ObjectInterface::buildArray
Text::__construct public function Constructs a new Text object.