You are here

trait MarkdownTrait in Markdown 8.2

Same name and namespace in other branches
  1. 3.0.x src/Traits/MarkdownTrait.php \Drupal\markdown\Traits\MarkdownTrait

Trait for adding the Markdown service to classes.

Hierarchy

File

src/Traits/MarkdownTrait.php, line 8

Namespace

Drupal\markdown\Traits
View source
trait MarkdownTrait {

  /**
   * The Markdown service.
   *
   * @var \Drupal\markdown\MarkdownInterface
   */
  protected static $markdown;

  /**
   * Retrieves the Markdown service.
   *
   * @return \Drupal\markdown\MarkdownInterface
   *   The Markdown service.
   */
  protected static function markdown() {
    if (!isset(static::$markdown)) {
      static::$markdown = \Drupal::service('markdown');
    }
    return static::$markdown;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MarkdownTrait::$markdown protected static property The Markdown service.
MarkdownTrait::markdown protected static function Retrieves the Markdown service.