diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php b/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php index e3f9092..2cd6b40 100644 --- a/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php +++ b/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php @@ -87,10 +87,9 @@ public function getAttributes() { * Overrides \Drupal\tour\Plugin\tour\tour\TipPluginInterface::getOutput(); */ public function getOutput() { - return array( - '#markup' => '

' . check_plain($this->getLabel()) . '

-

' . filter_xss_admin($this->getBody()) . '

' - ); + $output = '

' . check_plain($this->getLabel()) . '

'; + $output .= '

' . filter_xss_admin($this->getBody()) . '

'; + return array('#markup' => $output); } } diff --git a/core/modules/tour/lib/Drupal/tour/Tests/TourPluginTest.php b/core/modules/tour/lib/Drupal/tour/Tests/TourPluginTest.php index 188e83c..8256eed 100644 --- a/core/modules/tour/lib/Drupal/tour/Tests/TourPluginTest.php +++ b/core/modules/tour/lib/Drupal/tour/Tests/TourPluginTest.php @@ -28,9 +28,6 @@ class TourPluginTest extends DrupalUnitTestBase { */ protected $pluginManager; - /** - * Defines test info. - */ public static function getInfo() { return array( 'name' => 'Tour plugin tests', @@ -39,9 +36,6 @@ public static function getInfo() { ); } - /** - * Sets up the test. - */ protected function setUp() { parent::setUp(); diff --git a/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php b/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php index 58e50f9..e42ff87 100644 --- a/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php +++ b/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php @@ -44,19 +44,19 @@ public function testTourFunctionality() { $this->drupalGet('tour-test-1'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-1', - ':text' => 'The first tip' + ':text' => 'The first tip', )); $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-2', - ':text' => 'The quick brown fox' + ':text' => 'The quick brown fox', )); $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 2.'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-1', - ':text' => 'La pioggia cade in spagna' + ':text' => 'La pioggia cade in spagna', )); $this->assertNotEqual(count($elements), 1, 'Did not find Italian variant of tip 1.'); @@ -67,13 +67,13 @@ public function testTourFunctionality() { $this->drupalGet('tour-test-2/subpath'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-2', - ':text' => 'The quick brown fox' + ':text' => 'The quick brown fox', )); $this->assertEqual(count($elements), 1, 'Found English variant of tip 2.'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-1', - ':text' => 'The first tip' + ':text' => 'The first tip', )); $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.'); @@ -84,13 +84,13 @@ public function testTourFunctionality() { $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-1', - ':text' => 'La pioggia cade in spagna' + ':text' => 'La pioggia cade in spagna', )); $this->assertEqual(count($elements), 1, 'Found Italian variant of tip 1.'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-test-1', - ':text' => 'The first tip' + ':text' => 'The first tip', )); $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.'); @@ -131,7 +131,7 @@ public function testTourFunctionality() { $this->drupalGet('tour-test-1'); $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array( ':data_id' => 'tour-code-test-1', - ':text' => 'The rain in spain' + ':text' => 'The rain in spain', )); $this->assertEqual(count($elements), 1, 'Found the required tip markup for tip 4'); @@ -139,7 +139,7 @@ public function testTourFunctionality() { // (tip 4) has the close button. $elements = $this->xpath('//li[@data-id=:data_id and @data-text=:text]', array( ':data_id' => 'tour-code-test-1', - ':text' => 'End tour' + ':text' => 'End tour', )); $this->assertEqual(count($elements), 1, 'Found code tip was weighted last and had "End tour".'); diff --git a/core/modules/tour/lib/Drupal/tour/TipPluginBase.php b/core/modules/tour/lib/Drupal/tour/TipPluginBase.php index 9c490ff..514381b 100644 --- a/core/modules/tour/lib/Drupal/tour/TipPluginBase.php +++ b/core/modules/tour/lib/Drupal/tour/TipPluginBase.php @@ -45,6 +45,7 @@ */ public function __construct(array $configuration, $plugin_id, CacheDecorator $discovery) { parent::__construct($configuration, $plugin_id, $discovery); + $this->definition = $this->discovery->getDefinition($plugin_id); $this->module = $this->definition['module']; } diff --git a/core/modules/tour/lib/Drupal/tour/TourManager.php b/core/modules/tour/lib/Drupal/tour/TourManager.php index 443886c..f71b240 100644 --- a/core/modules/tour/lib/Drupal/tour/TourManager.php +++ b/core/modules/tour/lib/Drupal/tour/TourManager.php @@ -30,6 +30,8 @@ public function __construct() { /** * Overrides \Drupal\Component\Plugin\PluginManagerBase::createInstance(). + * + * Pass the TipsBag to the plugin constructor. */ public function createInstance($plugin_id, array $configuration = array(), TipsBag $bag = NULL) { $plugin_class = DefaultFactory::getPluginClass($plugin_id, $this->discovery); diff --git a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php index af280a3..bde0902 100644 --- a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php +++ b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php @@ -40,9 +40,9 @@ class TipPluginImage extends TipPluginBase { * Overrides \Drupal\tour\Plugin\tour\tour\TipPluginInterface::getOutput(). */ public function getOutput() { - return array( - '#markup' => '

' . check_plain($this->get('label')) . '

-

' . theme('image', array('uri' => $this->get('url'), 'alt' => $this->get('alt'))) . '

' - ); + $output = '

' . check_plain($this->get('label')) . '

'; + $output .= '

' . theme('image', array('uri' => $this->get('url'), 'alt' => $this->get('alt'))) . '

'; + return array('#markup' => $output); } + } diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index d24b49e..b4735b9 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -207,7 +207,7 @@ function tour_preprocess_page(&$variables) { } /** - * Implements hook_tour_tour_insert(). + * Implements hook_tour_insert(). */ function tour_tour_insert($entity) { drupal_container()->get('plugin.manager.tour')->clearCachedDefinitions(); @@ -215,7 +215,7 @@ function tour_tour_insert($entity) { } /** - * Implements hook_tour_tour_update(). + * Implements hook_tour_update(). */ function tour_tour_update($entity) { drupal_container()->get('plugin.manager.tour')->clearCachedDefinitions();