Commit cd0b9b30 authored by catch's avatar catch
Browse files

fix: #3557357 \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator...

fix: #3557357 \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator triggers deprecations on PHP 8.5

By: @alexpott
(cherry picked from commit 18702fdb)
parent e277b7c8
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ protected function getDerivatives(array $base_plugin_definitions) {
   *
   * @return array
   *   An array with the base plugin id as the first index and the derivative id
   *   as the second. If there is no derivative id it will be null.
   *   as the second. If there is no derivative id it will be an empty string.
   */
  protected function decodePluginId($plugin_id) {
    // Try and split the passed plugin definition into a plugin and a
@@ -137,7 +137,7 @@ protected function decodePluginId($plugin_id) {
      return explode(':', $plugin_id, 2);
    }

    return [$plugin_id, NULL];
    return [$plugin_id, ''];
  }

  /**
+4 −4
Original line number Diff line number Diff line
@@ -38,10 +38,10 @@ public function getDerivativeDefinitions($base_plugin_definition) {
    unset($base_plugin_definition['deriver']);

    $derivatives = [
      // Adding a NULL key signifies that the base plugin may also be used in
      // addition to the derivatives. In this case, we allow the administrator
      // to add a generic layout block to the page.
      NULL => $base_plugin_definition,
      // Adding an empty string key signifies that the base plugin may also be
      // used in addition to the derivatives. In this case, we allow the
      // administrator to add a generic layout block to the page.
      '' => $base_plugin_definition,

      // We also allow them to add a customized one. Here, we just mock the
      // customized one, but in a real implementation, this would be fetched