Skip to content
Snippets Groups Projects

Issue #3223022 reroll of StryKaizer's "discard changes" dialog in the...

Issue #3223022 reroll of StryKaizer's "discard changes" dialog in the...

Issue #3223022 reroll of StryKaizer's "discard changes" dialog in the off-canvas tray and update for changes in 11.x branch, following guidance of tim-diels

Closes #3223022

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
189 ],
190 '#submit' => [
191 [$this, 'submitRevertDefaults'],
192 ],
177 193 ];
194
178 195 return $actions;
179 196 }
180 197
198 /**
199 * Ajax callback to cancel discard changes.
200 *
201 * @return \Drupal\Core\Ajax\AjaxResponse
202 * An ajax response object.
203 */
204 public function ajaxCallbackDiscardChanges() {
  • 207 $settings = [
    208 'title' => $this->t('Discard changes'),
    209 'modal' => TRUE,
    210 'resizable' => TRUE,
    211 ];
    212 $command = new OpenModalDialogWithUrl($url->toString(),
    213 $settings);
    214 $response->addCommand($command);
    215
    216 return $response;
    217 }
    218
    219 /**
    220 * Non Ajax redirect to discard changes form.
    221 */
    222 public function submitDiscardChanges(array $form, FormStateInterface $form_state) {
  • 221 */
    222 public function submitDiscardChanges(array $form, FormStateInterface $form_state) {
    223 // Generate the URL using the sectionStorage's getLayoutBuilderUrl method.
    224 $url = $this->sectionStorage->getLayoutBuilderUrl('discard_changes');
    225
    226 // Set the redirect to the generated "Discard changes" page.
    227 $form_state->setRedirectUrl($url);
    228 }
    229
    230 /**
    231 * Ajax callback to Revert defaults .
    232 *
    233 * @return \Drupal\Core\Ajax\AjaxResponse
    234 * An ajax response object.
    235 */
    236 public function ajaxCallbackRevertDefaults() {
  • 241 'modal' => TRUE,
    242 'resizable' => TRUE,
    243 ];
    244 $command = new OpenModalDialogWithUrl($url->toString(),
    245 $settings);
    246 $response->addCommand($command);
    247
    248 return $response;
    249 }
    250
    251 /**
    252 * Non Ajax redirect to "Revert defaults" form.
    253 *
    254 * We need this one if our javascript doesn't work for some reason.
    255 */
    256 public function submitRevertDefaults(array $form, FormStateInterface $form_state) {
  • 186 202 /**
    187 203 * Provides test data for ::testNoLayoutSave().
    188 204 */
    189 public static function layoutNoSaveProvider() {
    205 public static function layoutNoSaveProvider():array {
  • added 1 commit

    • 0ca5664a - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • added 1 commit

    • d9388637 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • added 1 commit

    • aba3f3b9 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • added 1 commit

    • 4a28875a - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Hi @smustgrave! I've applied all your suggestions to the patch. However, I reviewed other Drupal core code and found only a few places where the same approach is used, i mean, the return type declarations for class methods and functions.

    Might be we should consider raising another ticket about this return type declaration issue?

  • Andrii Kocherhin added 104 commits

    added 104 commits

    • 4a28875a...83d68bd7 - 102 commits from branch project:11.x
    • fdabd1a3 - Merge remote-tracking branch 'origin/11.x' into 3223022-modal-discard-dialog
    • 0316728b - Rollback layoutNoSaveProvider function type declaration

    Compare with previous version

  • added 62 commits

    Compare with previous version

  • added 73 commits

    • 4d77e19d...4548e070 - 72 commits from branch project:11.x
    • 78921c5e - Merge branch '11.x' of github.com:drupal/drupal into 3223022-modal-discard-dialog

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Stephen Mustgrave added 438 commits

    added 438 commits

    • ff7b6ec3...cbdeab5c - 437 commits from branch project:11.x
    • c279f17a - Merge branch '11.x' of github.com:drupal/drupal into 3223022-modal-discard-dialog

    Compare with previous version

  • David Cameron added 343 commits

    added 343 commits

    Compare with previous version

  • Please register or sign in to reply
    Loading