You are here

class DefaultTwigExtension in Opigno messaging 8

Class DefaultTwigExtension.

Hierarchy

  • class \Drupal\opigno_messaging\TwigExtension\DefaultTwigExtension extends \Drupal\opigno_messaging\TwigExtension\Twig_Extension

Expanded class hierarchy of DefaultTwigExtension

1 string reference to 'DefaultTwigExtension'
opigno_messaging.services.yml in ./opigno_messaging.services.yml
opigno_messaging.services.yml
1 service uses DefaultTwigExtension
opigno_messaging.twig.extension in ./opigno_messaging.services.yml
Drupal\opigno_messaging\TwigExtension\DefaultTwigExtension

File

src/TwigExtension/DefaultTwigExtension.php, line 8

Namespace

Drupal\opigno_messaging\TwigExtension
View source
class DefaultTwigExtension extends \Twig_Extension {

  /**
   * {@inheritdoc}
   */
  public function getTokenParsers() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getNodeVisitors() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getFilters() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getTests() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getFunctions() {
    return [
      new \Twig_SimpleFunction('get_unread_thread_count', [
        $this,
        'get_unread_thread_count',
      ]),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getOperators() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return 'opigno_messaging.twig.extension';
  }

  /**
   * Returns unread thread count.
   */
  public function get_unread_thread_count() {
    return \Drupal::service('private_message.service')
      ->getUnreadThreadCount();
  }

}

Members