public function ShortcodeBase::getTitleFromAttributes in Shortcode 8
Same name and namespace in other branches
- 2.0.x src/Plugin/ShortcodeBase.php \Drupal\shortcode\Plugin\ShortcodeBase::getTitleFromAttributes()
Returns a suitable title string given the user provided title and text.
Parameters
string $title: The user provided title.
string $text: The user provided text.
Return value
string The title to be used.
2 calls to ShortcodeBase::getTitleFromAttributes()
- ButtonShortcode::process in shortcode_basic_tags/
src/ Plugin/ Shortcode/ ButtonShortcode.php - Performs the shortcode processing.
- LinkShortcode::process in shortcode_basic_tags/
src/ Plugin/ Shortcode/ LinkShortcode.php - Performs the shortcode processing.
File
- src/
Plugin/ ShortcodeBase.php, line 361
Class
- ShortcodeBase
- Provides a base class for Shortcode plugins.
Namespace
Drupal\shortcode\PluginCode
public function getTitleFromAttributes($title, $text) {
// Allow setting no title.
if ($title === '<none>') {
$title = '';
}
else {
$title = empty($title) ? trim(strip_tags($text)) : Html::escape($title);
}
return $title;
}