Unverified Commit e79ec476 authored by Mark Halliwell's avatar Mark Halliwell
Browse files

Issue #3117961 by markcarver, pavnish, rpayanm, divyesh19: [bootstrap_layouts] Drupal 9 support



Signed-off-by: default avatarMark Carver <mark.carver@me.com>
parent 0db7dada
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ name: Bootstrap Layouts
type: module
description: This module is going to generate layouts with Bootstrap grid system.
core: 8.x
core_version_requirement: '^8 || ^9'
package: Layout
dependencies:
  - drupal:layout_discovery
+20 −4
Original line number Diff line number Diff line
@@ -268,11 +268,27 @@ class BootstrapLayoutsManager extends BootstrapLayoutsPluginManager {
            try {
              $handler->saveInstance($storage_id, $layout);
              if ($display_messages) {
                \drupal_set_message($this->t('Successfully updated the existing Bootstrap layout found in "@id".', ['@id' => $storage_id]));
                $message = $this->t('Successfully updated the existing Bootstrap layout found in "@id".', ['@id' => $storage_id]);
              }
            }
            catch (\Exception $exception) {
              $message = $this->t('Unable to update the existing Bootstrap layout found in "@id":', ['@id' => $storage_id]);
            }
            if (isset($message)) {
              $error = isset($exception) ? $exception->getMessage() : FALSE;
              $type = $error ? 'error' : 'status';
              if (\Drupal::hasService('messenger') && ($messenger = \Drupal::messenger())) {
                $messenger->addMessage($message, $type);
                if ($error) {
                  $messenger->addError($error);
                }
              }
              else {
                drupal_set_message($message, $type);
                if ($error) {
                  drupal_set_message($error, 'error');
                }
              }
            } catch (\Exception $e) {
              \drupal_set_message($this->t('Unable to update the existing Bootstrap layout found in "@id":', ['@id' => $storage_id]), 'error');
              \drupal_set_message($e->getMessage(), 'error');
            }
          }
        }