Commit 463814b5 authored by Project Update Bot's avatar Project Update Bot Committed by Travis Tomka
Browse files

Issue #3288121 by Project Update Bot: Automated Drupal 10 compatibility fixes

parent 4a4083ef
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
<?php

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
 * @file
 * Define the JS component API documentation.
@@ -20,12 +22,12 @@
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *   The form state instance.
 */
function hook_js_component_form_alter(array &$form, array $configuration, Drupal\Core\Form\FormStateInterface $form_state) {
function hook_js_component_form_alter(array &$form, array $configuration, FormStateInterface $form_state) {
  $form['resource'] = [
    '#type' => 'select',
    '#title' => new Drupal\Core\StringTranslation\TranslatableMarkup('Resource'),
    '#title' => new TranslatableMarkup('Resource'),
    '#options' => [],
    '#empty_option' => new Drupal\Core\StringTranslation\TranslatableMarkup('- None -'),
    '#empty_option' => new TranslatableMarkup('- None -'),
    '#default_value' => $configuration['resource'] ?? NULL,
  ];
}
@@ -40,7 +42,7 @@ function hook_js_component_form_alter(array &$form, array $configuration, Drupal
 */
function hook_js_component_form_submit(
  array &$values,
  Drupal\Core\Form\FormStateInterface $form_state
  FormStateInterface $form_state
) {
  if ($resource = $form_state->getValue('resource')) {
    $values['resource'] = $resource;
+1 −2
Original line number Diff line number Diff line
type: module
name: JS Component
description: Define JS components as custom blocks from a theme or module.
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.3 || ^10
package: Other
+1 −1
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@

namespace Drupal\js_component\Event;

use Symfony\Contracts\EventDispatcher\Event;
use Drupal\js_component\Plugin\JSComponent;
use Symfony\Component\EventDispatcher\Event;

/**
 * Build component data event object.
+2 −2
Original line number Diff line number Diff line
@@ -611,8 +611,8 @@ class JSComponentBlockType extends BlockBase implements ContainerFactoryPluginIn
    );

    return ($this->eventDispatcher->dispatch(
      Events::BUILD_COMPONENT_DATA,
      $component_data_event
      $component_data_event,
      Events::BUILD_COMPONENT_DATA
    ))->build();
  }

+1 −1
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ class JSComponent extends PluginBase implements JSComponentInterface, ContainerF
   * @throws \Exception
   */
  public function getProviderPath() {
    return drupal_get_path($this->getProviderType(), $this->provider());
    return \Drupal::service('extension.path.resolver')->getPath($this->getProviderType(), $this->provider());
  }

  /**