function _cookies_video_media_oembed_handler in COOKiES Consent Management 1.0.x
Handling oembed and blazy_oembed field formatters.
Parameters
array $variables: Field template variables (s. cookies_video_preprocess_field()).
1 call to _cookies_video_media_oembed_handler()
- cookies_video_preprocess_field in modules/
cookies_video/ cookies_video.module - Implements hook_preprocess_HOOK().
File
- modules/
cookies_video/ cookies_video.module, line 53 - Contains cookies_video.module.
Code
function _cookies_video_media_oembed_handler(array &$variables) {
$formatter = $variables["element"]["#formatter"];
$doKo = CookiesKnockOutService::getInstance()
->doKnockOut();
if ($doKo) {
foreach ($variables["items"] as &$item) {
switch ($formatter) {
case 'oembed':
_cookies_video_preprocess_field_item_oembed($item);
break;
case 'blazy_oembed':
_cookies_video_preprocess_field_item_blazy_oembed($item);
break;
default:
}
// Attach library.
if (!isset($item["content"]["#attached"])) {
$item["content"]["#attached"] = [
"library" => [],
];
}
if (!isset($item["content"]["#attached"]["library"])) {
$item["content"]["#attached"]["library"] = [];
}
$item["content"]["#attached"]["library"][] = 'cookies_video/cookies_media';
}
}
}