public function QuoteShortcode::process in Shortcode 8
Same name and namespace in other branches
- 2.0.x shortcode_basic_tags/src/Plugin/Shortcode/QuoteShortcode.php \Drupal\shortcode_basic_tags\Plugin\Shortcode\QuoteShortcode::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/ QuoteShortcode.php, line 22
Class
- QuoteShortcode
- Replace the given text formatted like as a quote.
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'], 'quote');
$output = [
'#theme' => 'shortcode_quote',
'#class' => $class,
'#author' => $attributes['author'],
'#text' => $text,
];
return $this
->render($output);
}