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 ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Status: Active » Postponed (maintainer needs more info)

There is An example tip in the test module, can you compare with that?

joshi.rohit100’s picture

Yes, I created my tip by looking test tip module.

Here is the link to my code :-

https://github.com/joshirohit100/tour_tip

rodrigoaguilera’s picture

Title: Not able to create new tour tip » Not able to create new tour tip plugin
joshi.rohit100’s picture

@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 ?

joshi.rohit100’s picture

Also 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).

rodrigoaguilera’s picture

As 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.

larowlan’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Tips must implement TipPluginInterface which includes the getAttributes() method.

larowlan’s picture

Status: Closed (works as designed) » Needs work
larowlan’s picture

Status: Needs work » Needs review
FileSize
658 bytes
larowlan’s picture

here's a failing test

The last submitted patch, 10: tour-attributes-2429481.fail_.patch, failed testing.

nick_schuch’s picture

Status: Needs review » Reviewed & tested by the community

Thankyou very much!

I see no reason why this cannot be RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This 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!

  • alexpott committed 88dbc38 on 8.0.x
    Issue #2429481 by larowlan: Not able to create new tour tip plugin
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.