diff --git a/core/composer.json b/core/composer.json index 550c781..aca4684 100644 --- a/core/composer.json +++ b/core/composer.json @@ -109,6 +109,7 @@ "drupal/migrate_drupal_ui": "self.version", "drupal/node": "self.version", "drupal/options": "self.version", + "drupal.off_canvas": "self.version", "drupal/page_cache": "self.version", "drupal/path": "self.version", "drupal/quickedit": "self.version", diff --git a/core/modules/outside_in/js/offcanvas.js b/core/modules/outside_in/js/offcanvas.js index 4d803fd..52a7ee1 100644 --- a/core/modules/outside_in/js/offcanvas.js +++ b/core/modules/outside_in/js/offcanvas.js @@ -108,7 +108,7 @@ // Construct off canvas internal elements. var $offcanvasClose = createOffCanvasClose($offcanvasWrapper, $page, pageWidth, animationDuration); - var $title = createTitle('My Title'); + var $title = createTitle(response.dialogOptions.title); var $offcanvasContent = createOffCanvasContent(response.data); // Put everything together. diff --git a/core/modules/outside_in/outside_in.links.contextual.yml b/core/modules/outside_in/outside_in.links.contextual.yml new file mode 100644 index 0000000..ee83136 --- /dev/null +++ b/core/modules/outside_in/outside_in.links.contextual.yml @@ -0,0 +1,4 @@ +outside_in.block_configure: + title: 'Quick Edit' + route_name: 'entity.block.edit_form' + group: 'block' diff --git a/core/modules/outside_in/outside_in.module b/core/modules/outside_in/outside_in.module new file mode 100644 index 0000000..6089206 --- /dev/null +++ b/core/modules/outside_in/outside_in.module @@ -0,0 +1,41 @@ +' . t('About') . ''; + // @todo Update help text. + $output .= '
' . t('The Outside In module is something that we should have help for.') . '
'; + return $output; + } +} + +/** + * Implements hook_contextual_links_view_alter(). + * + * Change Configure Blocks into offcanvas links. + */ +function outside_in_contextual_links_view_alter(&$element, $items) { + if (isset($element['#links']['outside-inblock-configure'])) { + $element['#links']['outside-inblock-configure']['attributes'] = [ + 'class' => ['use-ajax'], + 'data-dialog-type' => 'offcanvas', + ]; + + $element['#attached'] = [ + 'library' => [ + 'outside_in/drupal.off_canvas', + ], + ]; + } +} diff --git a/core/modules/outside_in/tests/src/Unit/Ajax/AjaxCommandsTest.php b/core/modules/outside_in/tests/src/Unit/Ajax/AjaxCommandsTest.php index a6ee7c6..d907b6c 100644 --- a/core/modules/outside_in/tests/src/Unit/Ajax/AjaxCommandsTest.php +++ b/core/modules/outside_in/tests/src/Unit/Ajax/AjaxCommandsTest.php @@ -12,10 +12,10 @@ class AjaxCommandsTest extends UnitTestCase { /** - * @covers \Drupal\Core\Ajax\OpenCanvasDialogCommand + * @covers \Drupal\outside_in\Ajax\OpenOffCanvasDialogCommand */ - public function testOpenCanvasDialogCommand() { - $command = $this->getMockBuilder('Drupal\Core\Ajax\OpenCanvasDialogCommand') + public function testOpenOffCanvasDialogCommand() { + $command = $this->getMockBuilder('Drupal\outside_in\Ajax\OpenOffCanvasDialogCommand') ->setConstructorArgs(array( 'Title', 'Text!
', array( 'url' => 'example',