Commit 031a22cd authored by alexpott's avatar alexpott

Issue #2030067 by nick_schuch: Human readable titles for Tour Tip plugin types.

parent 099a8ace
......@@ -7,14 +7,14 @@
namespace Drupal\tour\Annotation;
use Drupal\Component\Annotation\PluginID;
use Drupal\Component\Annotation\Plugin;
/**
* Defines a Tip annotation object.
*
* @Annotation
*/
class Tip extends PluginID {
class Tip extends Plugin {
/**
* The plugin ID.
......@@ -23,4 +23,13 @@ class Tip extends PluginID {
*/
public $id;
/**
* The title of the plugin.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $title;
}
......@@ -7,6 +7,7 @@
namespace Drupal\tour\Plugin\tour\tip;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Utility\Token;
use Drupal\tour\Annotation\Tip;
......@@ -16,7 +17,10 @@
/**
* Displays some text as a tip.
*
* @Tip("text")
* @Tip(
* id = "text",
* title = @Translation("Text")
* )
*/
class TipPluginText extends TipPluginBase implements ContainerFactoryPluginInterface {
......@@ -120,4 +124,5 @@ public function getOutput() {
$output .= '<p class="tour-tip-body" id="tour-tip-' . $this->getAriaId() . '-contents">' . filter_xss_admin($this->token->replace($this->getBody())) . '</p>';
return array('#markup' => $output);
}
}
......@@ -7,13 +7,17 @@
namespace Drupal\tour_test\Plugin\tour\tip;
use Drupal\Core\Annotation\Translation;
use Drupal\tour\Annotation\Tip;
use Drupal\tour\TipPluginBase;
/**
* Displays an image as a tip.
*
* @Tip("image")
* @Tip(
* id = "image",
* title = @Translation("Image")
* )
*/
class TipPluginImage extends TipPluginBase {
......
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