first set of Maud corrections

This commit is contained in:
Bachir Soussi Chiadmi
2015-03-17 18:39:43 +01:00
parent f155c4705a
commit e323a84aec
39 changed files with 12866 additions and 1950 deletions
+68 -1
View File
@@ -30,4 +30,71 @@ function jeemod_entity_info_alter(&$entity_info) {
'label' => t('chapter'),
'custom settings' => TRUE,
);
}
}
/**
* Implements hook_video_embed_field_handlers_alter().
*/
function jeemod_video_embed_field_handlers_alter(&$handlers) {
$handlers['vimeo']['function'] = 'jeemod_handle_vimeo';
}
/**
* Wrapper function to allow forcing API to be enabled for Vimeo videos.
*/
function jeemod_handle_vimeo($url, $settings) {
// dsm($settings, 'settings');
// dsm($url, 'url');
$settings['api'] = 1;
// $r = db_query("SELECT entity_id FROM {field_data_field_video} WHERE field_video_video_url = :url", array(
// ':url' => $url
// ));
// foreach($r as $result){
// $id = $result->entity_id;
// }
// $id =
// $settings['player_id'] = "video".$id;
// return video_embed_field_handle_vimeo($url, $settings);
// needed to rewrite the whole output here
// https://github.com/jrue/Vimeo-jQuery-API
// Get ID of video from URL
$vid = _video_embed_field_get_vimeo_id($url);
if (!$vid) {
return array(
'#markup' => l($url, $url),
);
}
// Construct the embed code
$settings['portrait'] = 0;
$width = $settings['width'];
$height = $settings['height'];
unset($settings['width']);
unset($settings['height']);
unset($settings['color']);
unset($settings['portrait']);
unset($settings['title']);
unset($settings['byline']);
unset($settings['autoplay']);
unset($settings['loop']);
$settings['player_id'] = "video-".uniqid();
$settings_str = _video_embed_code_get_settings_str($settings);
return array(
'#markup' => '<iframe id="video'.$settings['player_id'].'" width="' . $width . '" height="' . $height . '" src="//player.vimeo.com/video/' . $vid .
'?' . $settings_str . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
);
}