Commit 6a727395 authored by Vitor Barbosa de Souza's avatar Vitor Barbosa de Souza Committed by De Araujo, Renato [CONBR Non-J&J]
Browse files

Issue #3288686 by vitorbs, reenaraghavan, Project Update Bot, lucassc,...

Issue #3288686 by vitorbs, reenaraghavan, Project Update Bot, lucassc, RenatoG, Ankit.Gupta, yashingole, gquisini, paulocs: Automated Drupal 10 compatibility fixes
parent a69c77f5
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Default JavaScript file for Modal Page.
 */

(function ($, Drupal, drupalSettings) {
(function ($, cookies, Drupal, drupalSettings) {
  'use strict';

  Drupal.behaviors.modalPage = {
@@ -42,11 +42,11 @@

        // Remove the cookie if show only once option is disabled.
        if (show_once != "1") {
          $.removeCookie('hide_modal_id_' + id_modal);
          cookies.remove('hide_modal_id_' + id_modal);
        }

        // Get cookies for do not show again option and show only once.
        var hide_modal_cookie = $.cookie('hide_modal_id_' + id_modal) || $.cookie('please_do_not_show_again_modal_id_' + id_modal);
        var hide_modal_cookie = cookies.get('hide_modal_id_' + id_modal) || cookies.get('please_do_not_show_again_modal_id_' + id_modal);

        // Verify don't show again and show only once options.
        if (hide_modal_cookie) {
@@ -74,7 +74,7 @@

        modal.on('hide.bs.modal', function () {
          if (show_once == "1") {
            $.cookie('hide_modal_id_' + id_modal, true, {expires: 365 * 20, path: '/'});
            cookies.set('hide_modal_id_' + id_modal, true, { expires: 365 * 20, path: '/' });
          }
        });

@@ -220,4 +220,4 @@
      });
    }
  };
})(jQuery, Drupal, drupalSettings);
})(jQuery, window.Cookies, Drupal, drupalSettings);
+1 −1
Original line number Diff line number Diff line
name: Modal Page
description: Create Modal
type: module
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^9.3 || ^10
package: User interface
configure: modal_page.settings
dependencies:
+1 −1
Original line number Diff line number Diff line
@@ -710,7 +710,7 @@ function update_modal_page_views() {
    return FALSE;
  }

  $config_views_path = drupal_get_path('module', 'modal_page') . '/config/optional/views.view.list_modal.yml';
  $config_views_path = \Drupal::service('extension.list.module')->getPath('modal_page') . '/config/optional/views.view.list_modal.yml';

  $data = Yaml::decode(file_get_contents($config_views_path));

+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ modal-page:
    js/modal-page.js: {}
  dependencies:
    - core/jquery
    - core/jquery.cookie
    - core/js-cookie
    - core/drupal

modal-page-admin:
+13 −5
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\modal_page\Service\ModalPageService;
use Drupal\Core\Extension\ExtensionPathResolver;

/**
 * Class Modal Form to use Entity.
@@ -44,14 +45,22 @@ class ModalForm extends EntityForm {
   */
  protected $modalPageService;

  /**
   * The extension path resolver.
   *
   * @var \Drupal\Core\Extension\ExtensionPathResolver
   */
  protected $extensionPathResolver;

  /**
   * Construct of Modal Page.
   */
  public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RendererInterface $renderer, ModalPageService $modalPageService) {
  public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RendererInterface $renderer, ModalPageService $modalPageService, ExtensionPathResolver $extension_path_resolver = NULL) {
    $this->languageManager = $language_manager;
    $this->configFactory = $config_factory;
    $this->renderer = $renderer;
    $this->modalPageService = $modalPageService;
    $this->extensionPathResolver = $extension_path_resolver;
  }

  /**
@@ -62,7 +71,8 @@ class ModalForm extends EntityForm {
      $container->get('language_manager'),
      $container->get('config.factory'),
      $container->get('renderer'),
      $container->get('modal_page.modals')
      $container->get('modal_page.modals'),
      $container->get('extension.path.resolver')
    );
  }

@@ -75,7 +85,7 @@ class ModalForm extends EntityForm {
    /** @var \Drupal\modal_page\Entity\Modal $modal */
    $modal = $this->entity;

    $imagePath = $imageUrl = '/' . drupal_get_path('module', 'modal_page') . '/images/';
    $imagePath = $imageUrl = '/' . $this->extensionPathResolver->getPath('module', 'modal_page') . '/images/';

    $modalImageMarkup = [
      '#theme' => 'modal_page_helper_admin',
@@ -1125,7 +1135,6 @@ class ModalForm extends EntityForm {
      $topRightButtonClass = $this->modalPageService->prepareClass($values['top_right_button_class']);

      $form_state->setValue('top_right_button_class', $topRightButtonClass);

    }

    if (!empty($values['footer_class'])) {
@@ -1148,7 +1157,6 @@ class ModalForm extends EntityForm {

      $form_state->setValue('left_button_class', $leftButtonClass);
    }

  }

  /**