function opigno_video_app_install in Opigno Video App 7
Implements hook_install().
File
- ./
opigno_video_app.install, line 11 - Contains install instructions and logic
Code
function opigno_video_app_install() {
// Check if content type exists.
$type = node_type_load("video");
if (empty($type)) {
$type = node_type_set_defaults(array(
'type' => 'video',
'name' => 'Video',
'base' => 'node_content',
'description' => 'A Video',
'has_title' => '1',
'title_label' => 'Title',
'help' => '',
));
node_type_save($type);
node_add_body_field($type);
}
if (module_exists('comment')) {
variable_set('comment_video', COMMENT_NODE_CLOSED);
}
variable_set('node_submitted_video', 0);
if (module_exists('print')) {
variable_set('print_display_video', 0);
variable_set('print_display_urllist_video', 0);
variable_set('print_pdf_display_video', 0);
variable_set('print_pdf_display_urllist_video', 0);
}
include_once drupal_get_path('module', 'og') . '/og_ui/og_ui.module';
if (function_exists('og_ui_node_type_save')) {
variable_set("og_group_content_type_video", TRUE);
og_ui_node_type_save('video');
opigno_video_app_update_og_group_ref();
if (module_exists('og_access')) {
og_create_field(OG_CONTENT_ACCESS_FIELD, 'node', 'video');
opigno_video_app_update_og_content_access();
}
}
$field = field_info_field('opigno_video');
if (empty($field)) {
field_create_field(array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'opigno_video',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => 0,
'module' => 'video',
'settings' => array(
'autoconversion' => 1,
'autothumbnail' => 'auto',
'default_video_thumbnail' => array(
'fid' => 0,
'remove_button' => 'Remove',
'upload' => '',
'upload_button' => 'Upload',
),
'presets' => array(
'Mp4' => 0,
),
'preview_video_thumb_style' => 'thumbnail',
'thumbnail_format' => 'jpg',
'uri_scheme' => 'public',
'uri_scheme_converted' => 'public',
'uri_scheme_thumbnails' => 'public',
),
'translatable' => 1,
'type' => 'video',
));
}
$instance = field_info_instance('node', 'opigno_video', 'video');
if (empty($instance)) {
field_create_instance(array(
'bundle' => 'video',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'video',
'settings' => array(
'poster_image_style' => '',
'widthxheight' => '640x360',
),
'type' => 'video_formatter_player',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 1,
),
),
'entity_type' => 'node',
'field_name' => 'opigno_video',
'label' => 'Video',
'required' => 0,
'settings' => array(
'default_dimensions' => '640x360',
'file_directory' => 'videos/original',
'file_extensions' => 'mp4 ogg avi mov wmv flv ogv webm',
'max_filesize' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'video',
'settings' => array(
'progress_indicator' => 'throbber',
),
'type' => 'video_upload',
'weight' => 32,
),
));
}
opigno_video_app_permissions_set();
module_load_include('inc', 'video_ui', 'video.admin');
$video_module_info = system_get_info('module', 'video');
if ($video_module_info['version'] >= '7.x-2.11') {
$extensions = video_utility::getVideoExtensionPlayers();
}
else {
$extensions = video_utility::getVideoExtensions();
}
$players = video_utility::getVideoPlayers();
$flv_players = video_video_flv_players();
$html5_players = video_video_html5_players();
foreach ($extensions as $ext => $player) {
variable_set('video_extension_' . $ext, 'video_play_html5');
variable_set('video_extension_' . $ext . '_html5_player', 'videojs');
}
// If we're in distribution context, refresh the strings and translations.
if (function_exists('opigno_lms_refresh_strings_and_import')) {
opigno_lms_refresh_strings_and_import(array(
'field',
));
}
// Enable Opigno Video plugin.
_opigno_video_app_enable_video_plugin();
// Enable Opigno Video filter.
_opigno_video_app_enable_video_filter();
}