hook_event_dispatcher-8.x-2.04/modules/preprocess_event_dispatcher/src/Variables/CommentEventVariables.php

modules/preprocess_event_dispatcher/src/Variables/CommentEventVariables.php
<?php

namespace Drupal\preprocess_event_dispatcher\Variables;

use Drupal\comment\CommentInterface;
use Drupal\Core\Entity\EntityInterface;

/**
 * Class CommentEventVariables.
 */
class CommentEventVariables extends AbstractEntityEventVariables {

  /**
   * Get the comment.
   *
   * @return \Drupal\comment\Entity\Comment
   *   The comment.
   */
  public function getComment(): CommentInterface {
    return $this->variables['comment'];
  }

  /**
   * {@inheritdoc}
   */
  public function getEntity(): EntityInterface {
    return $this->getComment();
  }

  /**
   * {@inheritdoc}
   */
  public function getEntityType(): string {
    return 'comment';
  }

  /**
   * Get commented entity.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   Commented entity.
   */
  public function getCommentedEntity(): EntityInterface {
    return $this->variables['commented_entity'];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc