public function ImageShortcode::tips in Shortcode 2.0.x
Same name and namespace in other branches
- 8 shortcode_basic_tags/src/Plugin/Shortcode/ImageShortcode.php \Drupal\shortcode_basic_tags\Plugin\Shortcode\ImageShortcode::tips()
Generates a filter's tip.
A filter's tips should be informative and to the point. Short tips are preferably one-liners.
@todo Split into getSummaryItem() and buildGuidelines().
Parameters
bool $long: Whether this callback should return a short tip to display in a form (FALSE), or whether a more elaborate filter tips should be returned for template_preprocess_filter_tips() (TRUE).
Return value
string|null Translated text to display as a tip, or NULL if this filter has no tip.
Overrides ShortcodeBase::tips
File
- shortcode_basic_tags/
src/ Plugin/ Shortcode/ ImageShortcode.php, line 66
Class
- ImageShortcode
- The image shortcode.
Namespace
Drupal\shortcode_basic_tags\Plugin\ShortcodeCode
public function tips($long = FALSE) {
$output = [];
$output[] = '<p><strong>' . $this
->t('[img (src="image.jpg"|mid="1") (class="additional class"|alt="alt text"|imagestyle="medium")/]') . '</strong> ';
$output[] = $this
->t('Inserts an image based on the given image url or media id. If media id is supplied with no alt text, the alt text from the media object will be applied.') . '</p>';
return implode(' ', $output);
}