class TipPluginImage

Displays an image as a tip.

Plugin annotation

@Tip("image");

Hierarchy

Expanded class hierarchy of TipPluginImage

File

drupal/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php, line 18
Contains \Drupal\tour_test\Plugin\tour\tour\TipPluginImage.

Namespace

Drupal\tour_test\Plugin\tour\tip
View source
class TipPluginImage extends TipPluginBase {

  /**
   * The url which is used for the image in this Tip.
   *
   * @var string
   *   A url used for the image.
   */
  protected $url;

  /**
   * The alt text which is used for the image in this Tip.
   *
   * @var string
   *   A alt text used for the image.
   */
  protected $alt;

  /**
   * Overrides \Drupal\tour\Plugin\tour\tour\TipPluginInterface::getOutput().
   */
  public function getOutput() {
    $image = array(
      '#theme' => 'image',
      '#uri' => $this
        ->get('url'),
      '#alt' => $this
        ->get('alt'),
    );
    $output = '<h2 class="tour-tip-label" id="tour-tip-' . $this
      ->get('ariaId') . '-label">' . check_plain($this
      ->get('label')) . '</h2>';
    $output .= '<p class="tour-tip-image" id="tour-tip-' . $this
      ->get('ariaId') . '-contents">' . drupal_render($image) . '</p>';
    return array(
      '#markup' => $output,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. 17
TipPluginBase::$attributes protected property The attributes that will be applied to the markup of this tip.
TipPluginBase::$label protected property The label which is used for render of this tip.
TipPluginBase::$weight protected property Allows tips to take more priority that others.
TipPluginBase::get public function Implements \Drupal\tour\TipPluginInterface::get(). Overrides TipPluginInterface::get
TipPluginBase::getAttributes public function Implements \Drupal\tour\TipPluginInterface::getAttributes(). Overrides TipPluginInterface::getAttributes 1
TipPluginBase::getLabel public function Implements \Drupal\tour\TipPluginInterface::getLabel(). Overrides TipPluginInterface::getLabel
TipPluginBase::getWeight public function Implements \Drupal\tour\TipPluginInterface::getWeight(). Overrides TipPluginInterface::getWeight
TipPluginBase::set public function Implements \Drupal\tour\TipPluginInterface::set(). Overrides TipPluginInterface::set
TipPluginImage::$alt protected property The alt text which is used for the image in this Tip.
TipPluginImage::$url protected property The url which is used for the image in this Tip.
TipPluginImage::getOutput public function Overrides \Drupal\tour\Plugin\tour\tour\TipPluginInterface::getOutput(). Overrides TipPluginInterface::getOutput