Verified Commit 82296cdf authored by tuutti's avatar tuutti
Browse files

Issue #3288541 by Project Update Bot: Automated Drupal 10 compatibility fixes,...

Issue #3288541 by Project Update Bot: Automated Drupal 10 compatibility fixes, require php 8.0, php 8 fixes
parent 25d8a961
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
{
    "name": "drupal/menu_block_current_language",
    "type": "drupal-module",
  "minimum-stability": "dev"
    "homepage": "http://drupal.org/project/menu_block_current_language",
    "license": "GPL-2.0+",
    "minimum-stability": "dev",
    "require": {
        "php": ">=8.0"
    }
}
+1 −1
Original line number Diff line number Diff line
name: Menu Block Current Language
type: module
description: Filters out all the menu links that does not have translation for the current language.
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.3 || ^10
dependencies:
  - drupal:block
  - drupal:locale
+4 −4
Original line number Diff line number Diff line
<?php

declare(strict_types = 1);

namespace Drupal\menu_block_current_language\Event;

/**
 * Class Events.
 *
 * @package Drupal\menu_block_current_language\Event
 * Event dispatcher events.
 */
final class Events {

  /**
   * Allows users to alter visibility of a menu link.
   */
  const HAS_TRANSLATION = 'menu_block_current_language.has_translation';
  public const HAS_TRANSLATION = 'menu_block_current_language.has_translation';

}
+10 −22
Original line number Diff line number Diff line
<?php

declare(strict_types = 1);

namespace Drupal\menu_block_current_language\Event;

use Symfony\Component\EventDispatcher\Event;
use Drupal\Core\Menu\MenuLinkInterface;
use Symfony\Contracts\EventDispatcher\Event;

/**
 * Translation event.
 */
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.
   *
@@ -32,9 +20,9 @@ class HasTranslationEvent extends Event {
   * @param bool $status
   *   The visibility.
   */
  public function __construct(MenuLinkInterface $link, $status) {
    $this->link = $link;
    $this->status = $status;
  public function __construct(
    protected MenuLinkInterface $link,
    protected bool $status) {
  }

  /**
@@ -43,7 +31,7 @@ class HasTranslationEvent extends Event {
   * @return bool
   *   The visibility.
   */
  public function hasTranslation() {
  public function hasTranslation() : bool {
    return $this->status;
  }

@@ -55,7 +43,7 @@ class HasTranslationEvent extends Event {
   *
   * @return $this
   */
  public function setHasTranslation($status) {
  public function setHasTranslation(bool $status) : self {
    $this->status = (bool) $status;
    return $this;
  }
@@ -66,7 +54,7 @@ class HasTranslationEvent extends Event {
   * @return \Drupal\Core\Menu\MenuLinkInterface
   *   The menu link.
   */
  public function getLink() {
  public function getLink() : MenuLinkInterface {
    return $this->link;
  }

@@ -78,7 +66,7 @@ class HasTranslationEvent extends Event {
   *
   * @return $this
   */
  public function setLink(MenuLinkInterface $menu_link) {
  public function setLink(MenuLinkInterface $menu_link) : self {
    $this->link = $menu_link;
    return $this;
  }
+3 −1
Original line number Diff line number Diff line
<?php

declare(strict_types = 1);

namespace Drupal\menu_block_current_language;

/**
@@ -20,6 +22,6 @@ interface MenuLinkTranslatableInterface {
   * @return bool
   *   TRUE if menu link has a translation, FALSE if not.
   */
  public function hasTranslation($langcode);
  public function hasTranslation(string $langcode) : bool;

}
Loading