Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Dont know if its a bug or I am doing wrong. I am just trying to create a new tour tip, so I have write this :-
id: rohit-custom-2
module: rohit_tour
label: Custom Tour
langcode: en
routes:
- route_name: node.add_page
tips:
custom_1:
id: custom_1
plugin: text
youtube_id: 'momomo'
label: Custom tour for learning
body: <p>dsdfdsfds</p>
weight: "1"
block-seven-content:
id: block-seven-content
plugin: custom
my_id: 'momomo'
label: Custom tour for learning
attributes:
data-id: block-seven-content
weight: "2"
in modulename/config/install/tour.tour.rohit-custom-2.yml file
Then I created a class in src/Plugin/tour/tip/TipPluginCustom.php as below.
/**
* Displays some text as a tip.
*
* @Tip(
* id = "custom",
* title = @Translation("CUstom")
* )
*/
class TipPluginCustom extends TipPluginBase {
protected $my_id;
/**
* {@inheritdoc}
*/
public function getOutput() {
$output = 'My Custom tip id => ' . $this->my_id;
return array('#markup' => $output);
}
}
where custom is my tip id.
But only first tour is showing.
Am i missing something ?
Comment | File | Size | Author |
---|---|---|---|
#10 | tour-attributes-2429481.pass_.patch | 980 bytes | larowlan |
#10 | tour-attributes-2429481.fail_.patch | 555 bytes | larowlan |
#9 | 8.0.x.tour_.patch | 658 bytes | larowlan |
Comments
Comment #1
larowlanThere is An example tip in the test module, can you compare with that?
Comment #2
joshi.rohit100Yes, I created my tip by looking test tip module.
Here is the link to my code :-
https://github.com/joshirohit100/tour_tip
Comment #3
rodrigoaguileraComment #4
joshi.rohit100@larowlan - I have now successfully created custom tour tip.
Here is the code:- https://github.com/joshirohit100/dummy/blob/master/config/install/tour.t...
The only problem that I am facing is that - If I don't mention attribute in tour tip,
'#wrapper_attributes' => $tip->getAttributes() + $attributes,
this line (line no - 49) in TourViewBuilder throws error.Is this core issue or attribute is required if creating custom tour tip ?
Comment #5
joshi.rohit100Also every time I need to update anything in tour yml or create new tour for existing module, I have to uninstall module. Is this right approach as I dont know If user can loose data on module uninstall (if custom table).
Comment #6
rodrigoaguileraAs you experienced, yml files are loaded into configuration when the module is installed.
Here are some tips to develop tours
https://www.drupal.org/node/1934442#tour-tips-tech-note
the default storage for the configuration installed is the database. I think you can change this to files so can edit active configuration.
Comment #7
larowlanTips must implement TipPluginInterface which includes the getAttributes() method.
Comment #8
larowlanComment #9
larowlanComment #10
larowlanhere's a failing test
Comment #12
nick_schuch CreditAttribution: nick_schuch commentedThankyou very much!
I see no reason why this cannot be RTBC.
Comment #13
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 88dbc38 and pushed to 8.0.x. Thanks!