Commit 551fca29 authored by Oleh Vehera's avatar Oleh Vehera
Browse files

Issue #3300192 by kyberman, voleger: PHP 8.1 Deprecated function

parent 8ee3c71f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
name: More Global Variables
core_version_requirement: ^8.8 || ^9 || ^10
core_version_requirement: ^9 || ^10
description: Some extra global variables to make your life a little easier.
type: module
+1 −5
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ function mgv_help($route_name, RouteMatchInterface $route_match) {
          ],
          'value' => [
            'data' => [
              '#markup' => $mgv->createInstance($id)->getValue(),
              '#markup' => $mgv->createInstance($id, $definition)->getValue(),
            ],
            'data-mgv-id' => $id,
          ],
@@ -100,11 +100,7 @@ function mgv_help($route_name, RouteMatchInterface $route_match) {
          ],
        ],
      ];

    default:
      return NULL;
  }

}

/**
+3 −7
Original line number Diff line number Diff line
@@ -54,16 +54,12 @@ class MgvPluginManager extends DefaultPluginManager implements MgvPluginManagerI
  public function getVariables() {
    if (empty($this->variables)) {
      $this->variables = [];
      $all = $this->getDefinitions();
      foreach ($all as $definition_info) {
      foreach ($this->getDefinitions() as $plugin_id => $definition) {
        /** @var \Drupal\mgv\Plugin\GlobalVariableInterface $variable */
        $variable = $this->createInstance($definition_info['id']);
        $variable = $this->createInstance($plugin_id, $definition);
        $this->variables = NestedArray::mergeDeep(
          $this->variables,
          $this->getNamespacedValue(
            $definition_info['id'],
            $variable
          )
          $this->getNamespacedValue($plugin_id, $variable),
        );
      }
    }
+4 −4
Original line number Diff line number Diff line
@@ -31,9 +31,9 @@ abstract class GlobalVariable extends PluginBase implements GlobalVariableInterf
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->dependency = empty($this->configurations['variableDependencies']) ?
      [] :
      $this->configurations['variableDependencies'];
    $this->dependency = !empty($configuration['variableDependencies']) ?
      $configuration['variableDependencies'] :
      [];
  }

  /**
@@ -46,7 +46,7 @@ abstract class GlobalVariable extends PluginBase implements GlobalVariableInterf
   *   Value of dependent global variable.
   */
  public function getDependency(string $id) {
    return empty($this->dependency[$id]) ? NULL : $this->dependency[$id];
    return !empty($this->dependency[$id]) ? $this->dependency[$id] : '';
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
namespace Drupal\mgv\Plugin\GlobalVariable;

use Drupal\Core\Controller\TitleResolverInterface;
use Drupal\Core\Http\RequestStack;
use Symfony\Component\HttpFoundation\RequestStack;
use Drupal\Core\Render\RendererInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

Loading