Skip to content
Snippets Groups Projects

Deprecation for dialogClass

Closes #3296098

Merge request reports

Merged results pipeline passed for ba52abb4

Approval is optional
Code Quality is loading
Test summary results are being parsed

Closed by Théodore BiadalaThéodore Biadala Apr 17, 2024 (Apr 17, 2024 3:14pm UTC)

Merge details

  • The changes were not merged into 10.3.x.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Théodore Biadala
  • 40 40 public function __construct(string|\Stringable|null $title, $content, array $dialog_options = [], $settings = NULL, $position = 'side') {
    41 $dialog_class = NULL;
    42 if (isset($dialog_options['classes']['ui-dialog'])) {
    43 $dialog_class = $dialog_options['classes']['ui-dialog'];
    44 }
    45 elseif (isset($dialog_options['dialogClass'])) {
    46 @trigger_error('Passing $dialog_options[\'dialogClass\'] to OpenOffCanvasDialogCommand::__construct() is deprecated in drupal:10.3.0 and will be removed in drupal:12.0.0. Use $dialog_options[\'classes\'] instead. See https://www.drupal.org/node/3440844', E_USER_DEPRECATED);
    47 $dialog_class = $dialog_options['dialogClass'];
    48 unset($dialog_options['dialog_class']);
    49 }
    50 if ($dialog_class) {
    51 $dialog_options['classes']['ui-dialog'] = $dialog_class . ' ' . "ui-dialog-off-canvas ui-dialog-position-$position";
    52 }
    53 else {
    54 $dialog_options['classes']['ui-dialog'] = "ui-dialog-off-canvas ui-dialog-position-$position";
    55 }
    • Comment on lines +50 to +55
      Suggested change
      49 if ($dialog_class) {
      50 $dialog_options['classes']['ui-dialog'] = $dialog_class . ' ' . "ui-dialog-off-canvas ui-dialog-position-$position";
      51 }
      52 else {
      53 $dialog_options['classes']['ui-dialog'] = "ui-dialog-off-canvas ui-dialog-position-$position";
      54 }
      49 $dialog_options['classes']['ui-dialog'] = "$dialog_class ui-dialog-off-canvas ui-dialog-position-$position";
      50

      maybe? Should work, we just need to define $dialog_class = '' instead of null

    • Author Maintainer

      That'd give us a leading space when dialog_class is an empty string, unless we add the leading space on the end of that variable, but a bit harder to read then I think.

    • Author Maintainer

      However I got rid of the string concatenation here.

    • Author Maintainer

      Actually this is fine, it just needs a trim()... Implemented that.

    • catch changed this line in version 15 of the diff

      changed this line in version 15 of the diff

    • Please register or sign in to reply
  • catch added 1 commit

    added 1 commit

    • 5375d259 - Always trigger_error() if dialogClass is passed in.

    Compare with previous version

  • Théodore Biadala
  • catch added 1 commit

    added 1 commit

    • 4a2f5b9a - Remove the unset since it's not strictly necessary.

    Compare with previous version

  • Théodore Biadala
  • catch added 1 commit

    added 1 commit

    • b1e926ff - Merge instead of overwriting classes when both are set.

    Compare with previous version

  • catch resolved all threads

    resolved all threads

  • catch added 1 commit

    added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading