You are here

function media_upload_media_register in D7 Media 6

Implementation of hook_media_register

Return value

array Form array items

File

media_upload/media_upload.module, line 16
This module provides integration for Drupal's upload module with the Media module

Code

function media_upload_media_register() {
  $items = array();

  // Register User files display
  $items['media_upload_user_files'] = array(
    'name' => t('User files'),
    'uri' => 'file',
    'kind' => 'resource',
    'types' => '*',
    'description' => t("Displays all of current user's files."),
    'callbacks' => array(
      'resource' => 'media_upload_user_files_select',
    ),
    'fields' => array(
      'attachments',
      'filefield',
    ),
  );

  // Register Add/Upload file functionality
  $items['media_upload_resource_add_file'] = array(
    'name' => 'Media Upload add file',
    'description' => t("Add new file using Drupal's Upload module"),
    'kind' => 'resource',
    'callbacks' => array(
      'resource' => 'media_upload_resource_add_file',
    ),
    'fields' => array(
      'attachments',
      'filefield',
    ),
  );

  // Register Embed file functionality
  $items['media_upload_resource_embed_file'] = array(
    'name' => 'Media Upload embed file',
    'description' => t("Embed file URI using Drupal's Upload module"),
    'uri' => 'file',
    'kind' => 'resource',
    'types' => '*',
    'callbacks' => array(
      'resource' => 'media_upload_resource_embed_file',
    ),
    'fields' => array(
      'attachments',
      'filefield',
    ),
  );

  // Register form formatter functionality
  $items['media_upload_formatter_form'] = array(
    'name' => 'Media Upload form formatter',
    'description' => "Media upload form formatter",
    'kind' => 'formatter',
    'callbacks' => array(
      'formatter' => 'media_upload_formatter_form',
    ),
    'fields' => array(
      'attachments',
      'filefield',
    ),
  );

  // Register action functionality
  // TODO: This may not be needed depending on our implementation of hook_media_action [see #480166]
  $items['media_upload_action'] = array(
    'name' => 'Media Upload action handler',
    'description' => t("Called to perform various actions such as attaching a file to a node"),
    'kind' => 'action',
    'types' => '*',
    'callbacks' => array(
      'action' => 'media_upload_action',
    ),
    'fields' => array(
      'attachments',
      'filefield',
    ),
  );
  return $items;
}