Commit 717241a2 authored by alexpott's avatar alexpott

Issue #1921132 by nick_schuch: Wrap each tour item in a class.

parent 7ba4db06
......@@ -38,6 +38,13 @@ class Tour extends ConfigEntityBase {
*/
public $id;
/**
* The module which this tour is assigned to.
*
* @var string
*/
public $module;
/**
* The label of the tour.
*
......
......@@ -40,9 +40,10 @@ protected function setUp() {
* Test tour functionality.
*/
public function testTourFunctionality() {
// Navigate to tour-test-1 and verify the tour_test_1 tip is found.
// Navigate to tour-test-1 and verify the tour_test_1 tip is found with appropriate classes.
$this->drupalGet('tour-test-1');
$elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
$elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./h2[contains(., :text)]]', array(
':classes' => 'tip-module-tour-test tip-type-text tip-tour-test-1 even last',
':data_id' => 'tour-test-1',
':text' => 'The first tip',
));
......
......@@ -26,6 +26,13 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
$list_items = array();
foreach ($tips as $index => $tip) {
if ($output = $tip->getOutput()) {
$attributes = array(
'class' => array(
'tip-module-' . drupal_clean_css_identifier($entity->get('module')),
'tip-type-' . drupal_clean_css_identifier($tip->get('plugin')),
'tip-' . drupal_clean_css_identifier($tip->get('id')),
),
);
$list_items[] = array(
'output' => $output,
'counter' => array(
......@@ -37,7 +44,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
),
'#children' => t('!tour_item of !total', array('!tour_item' => $index + 1, '!total' => $count)),
),
'#wrapper_attributes' => $tip->getAttributes(),
'#wrapper_attributes' => $tip->getAttributes() + $attributes,
);
}
}
......
id: tour-test-2
module: tour_test
label: Tour test english
langcode: en
paths:
......
id: tour-test
module: tour_test
label: Tour test english
langcode: en
paths:
......
id: views-ui
module: views_ui
label: Views ui
langcode: en
paths:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment