You are here

class HasTranslationEvent in Menu block current language 8

Translation event.

Hierarchy

  • class \Drupal\menu_block_current_language\Event\HasTranslationEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of HasTranslationEvent

1 file declares its use of HasTranslationEvent
MenuLinkTreeManipulator.php in src/MenuLinkTreeManipulator.php

File

src/Event/HasTranslationEvent.php, line 11

Namespace

Drupal\menu_block_current_language\Event
View source
class HasTranslationEvent extends Event {

  /**
   * The menu link.
   *
   * @var \Drupal\Core\Menu\MenuLinkInterface
   */
  protected $link;

  /**
   * Determines if menu link is visible.
   *
   * @var bool
   */
  protected $status;

  /**
   * HasTranslationEvent constructor.
   *
   * @param \Drupal\Core\Menu\MenuLinkInterface $link
   *   The menu link.
   * @param bool $status
   *   The visibility.
   */
  public function __construct(MenuLinkInterface $link, $status) {
    $this->link = $link;
    $this->status = $status;
  }

  /**
   * Determines if link should be visible or not.
   *
   * @return bool
   *   The visibility.
   */
  public function hasTranslation() {
    return $this->status;
  }

  /**
   * Sets the visibility.
   *
   * @param bool $status
   *   The visibility.
   *
   * @return $this
   */
  public function setHasTranslation($status) {
    $this->status = (bool) $status;
    return $this;
  }

  /**
   * Gets the menu link.
   *
   * @return \Drupal\Core\Menu\MenuLinkInterface
   *   The menu link.
   */
  public function getLink() {
    return $this->link;
  }

  /**
   * Sets the menu link.
   *
   * @param \Drupal\Core\Menu\MenuLinkInterface $menu_link
   *   The menu link.
   *
   * @return $this
   */
  public function setLink(MenuLinkInterface $menu_link) {
    $this->link = $menu_link;
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HasTranslationEvent::$link protected property The menu link.
HasTranslationEvent::$status protected property Determines if menu link is visible.
HasTranslationEvent::getLink public function Gets the menu link.
HasTranslationEvent::hasTranslation public function Determines if link should be visible or not.
HasTranslationEvent::setHasTranslation public function Sets the visibility.
HasTranslationEvent::setLink public function Sets the menu link.
HasTranslationEvent::__construct public function HasTranslationEvent constructor.