VideoEmbedIFrame.php in Video Embed Field 8.2
File
src/Element/VideoEmbedIFrame.php
View source
<?php
namespace Drupal\video_embed_field\Element;
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Template\Attribute;
class VideoEmbedIFrame extends RenderElement {
public function getInfo() {
return [
'#theme' => 'video_embed_iframe',
'#provider' => '',
'#url' => '',
'#query' => [],
'#attributes' => [],
'#fragment' => [],
'#pre_render' => [
[
static::class,
'preRenderInlineFrameEmbed',
],
],
];
}
public static function preRenderInlineFrameEmbed($element) {
$element['#theme'] .= !empty($element['#provider']) ? '__' . $element['#provider'] : '';
if (is_array($element['#attributes'])) {
$element['#attributes'] = new Attribute($element['#attributes']);
}
return $element;
}
}