MENU_CALLBACK, 'file' => 'jeemod.pages.inc', ); $items['jee/chapter'] = $base+array( 'title' => 'jee', 'page callback' => 'jeemod_chapter', 'page arguments' => array(2), 'access callback' => TRUE, // 'access arguments' => array('use materio search api'), ); $items['jee/static'] = $base+array( 'title' => 'jee', 'page callback' => 'jeemod_static', // 'page arguments' => array(2), 'access callback' => TRUE, // 'access arguments' => array('use materio search api'), ); return $items; } /** * Implements hook_entity_info_alter(). */ function jeemod_entity_info_alter(&$entity_info) { $entity_info['node']['view modes']['chapter'] = array( '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' => '', ); }