public static function Disqus::generatePlaceholder in Disqus 8
Pre_render callback to generate a placeholder.
Parameters
array $element: A renderable array.
Return value
array The updated renderable array containing the placeholder.
File
- src/
Element/ Disqus.php, line 39
Class
- Disqus
- Provides Disqus render element.
Namespace
Drupal\disqus\ElementCode
public static function generatePlaceholder(array $element) {
if (\Drupal::currentUser()
->hasPermission('view disqus comments')) {
$element[] = [
'#lazy_builder' => [
get_class() . '::displayDisqusComments',
[
$element['#title'],
$element['#url'],
$element['#identifier'],
serialize($element['#callbacks']),
],
],
'#create_placeholder' => TRUE,
];
}
return $element;
}