public function DropcapShortcode::process in Shortcode 8
Same name and namespace in other branches
- 2.0.x shortcode_basic_tags/src/Plugin/Shortcode/DropcapShortcode.php \Drupal\shortcode_basic_tags\Plugin\Shortcode\DropcapShortcode::process()
Performs the shortcode processing.
Parameters
array $attributes: Array of attributes.
string $text: The text string to be processed.
string $langcode: The language code of the text to be filtered. Defaults to LANGCODE_NOT_SPECIFIED.
Return value
string The processed text.
Overrides ShortcodeInterface::process
File
- shortcode_basic_tags/
src/ Plugin/ Shortcode/ DropcapShortcode.php, line 22
Class
- DropcapShortcode
- Replace the given text formatted like as a dropcap.
Namespace
Drupal\shortcode_basic_tags\Plugin\ShortcodeCode
public function process(array $attributes, $text, $langcode = Language::LANGCODE_NOT_SPECIFIED) {
// Merge with default attributes.
$attributes = $this
->getAttributes([
'class' => '',
'author' => '',
], $attributes);
$class = $this
->addClass($attributes['class'], 'dropcap');
$output = [
'#theme' => 'shortcode_dropcap',
'#class' => $class,
'#text' => $text,
];
return $this
->render($output);
}