You are here

media_sharestream.install in Media: ShareStream 7

Install, update and uninstall functions for the Media: ShareStream module.

File

media_sharestream.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Media: ShareStream module.
 */

/**
 * Implements hook_install().
 */
function media_sharestream_install() {

  // Create initial display settings.
  module_load_include('inc', 'file_entity', 'file_entity.file_api');
  $existing_display = file_displays_load('video', 'default');
  if (empty($existing_display)) {

    // Video previews should be displayed using a large filetype icon.
    $display = array(
      'api_version' => 1,
      'name' => 'video__default__media_sharestream_video',
      'weight' => 0,
      'status' => 1,
      'settings' => array(
        'width' => '420',
        'height' => '315',
        'autoplay' => 0,
      ),
    );
    file_display_save((object) $display);
    $display = array(
      'api_version' => 1,
      'name' => 'video__preview__media_sharestream_image',
      'weight' => 0,
      'status' => 1,
      'settings' => array(
        'image_style' => 'media_thumbnail',
      ),
    );
    file_display_save((object) $display);
  }

  /**
   * Implements hook_uninstall().
   */
  function media_sharestream_uninstall() {

    // Remove variables.
    variable_del('media_sharestream_server');
  }
}

/**
 * Delete preview.png out of the 'media-youtube' folder in the files directory.
 */
function media_sharestream_update_7100(&$sandbox) {

  // The preview image was initially saved to the wrong folder: media-youtube.
  $preview = 'public://media-youtube/preview.png';
  if (file_exists($preview)) {
    file_unmanaged_delete($preview);
  }
}

Functions

Namesort descending Description
media_sharestream_install Implements hook_install().
media_sharestream_update_7100 Delete preview.png out of the 'media-youtube' folder in the files directory.