function _cookies_video_preprocess_field_item_oembed in COOKiES Consent Management 1.0.x
Handling field_item from oembed formatter.
1 call to _cookies_video_preprocess_field_item_oembed()
- _cookies_video_media_oembed_handler in modules/
cookies_video/ cookies_video.module - Handling oembed and blazy_oembed field formatters.
File
- modules/
cookies_video/ cookies_video.module, line 85 - Contains cookies_video.module.
Code
function _cookies_video_preprocess_field_item_oembed(&$item) {
// Move src to data-src and replace src by fallback.
$src = $item["content"]["#attributes"]["src"];
$item["content"]["#attributes"]["data-src"] = $src;
$item["content"]["#attributes"]["src"] = '';
// Set marker class.
if (!isset($item["content"]["#attributes"]["class"]) || !is_array($item["content"]["#attributes"]["class"])) {
$item["content"]["#attributes"]["class"] = [];
}
$item["content"]["#attributes"]["class"][] = 'cookies-video';
}