You are here

media_acquiadam_browser.module in Media: Acquia DAM 7

File

modules/media_acquiadam_browser/media_acquiadam_browser.module
View source
<?php

/**
 * @file
 * Drupal hook implementations.
 */
require_once 'includes/media_acquiadam_browser.helpers.inc';
require_once 'includes/media_acquiadam_browser.forms.inc';
require_once 'includes/media_acquiadam_browser.theme.inc';

/**
 * Implements hook_menu().
 */
function media_acquiadam_browser_menu() {
  $items = [];
  $items['admin/content/file/acquiadam'] = [
    'title' => 'Acquia DAM',
    'page callback' => 'drupal_get_form',
    'page arguments' => [
      'media_acquiadam_browser_choose_asset_form',
    ],
    'access arguments' => [
      'access media acquiadam browser',
    ],
    'file' => 'includes/media_acquiadam_browser.forms.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 100,
  ];
  $items['admin/content/file/acquiadam/saved'] = [
    'title' => 'Saved Acquia DAM assets',
    'page callback' => 'media_acquiadam_browser_choose_asset_saved_landing_page',
    'access arguments' => [
      'access media acquiadam browser',
    ],
    'file' => 'includes/media_acquiadam_browser.pages.inc',
    'type' => MENU_CALLBACK,
  ];
  $items['dam/%ctools_js/%/%media_acquiadam_asset/info'] = [
    'title' => 'Asset information',
    'page arguments' => [
      3,
      1,
    ],
    'page callback' => 'media_acquiadam_browser_info_modal_page',
    'load arguments' => [
      2,
    ],
    'access callback' => 'media_acquiadam_asset_access',
    'access arguments' => [
      'view',
      3,
    ],
    'theme callback' => 'ajax_base_page_theme',
    'file' => 'includes/media_acquiadam_browser.pages.inc',
    'type' => MENU_CALLBACK,
  ];
  return $items;
}

/**
 * Implements hook_permission().
 */
function media_acquiadam_browser_permission() {
  $perms = [];
  $perms['access media acquiadam browser'] = [
    'title' => t('Access Media: Acquia DAM Browser'),
    'description' => t('Allows the user to access the Acquia DAM browser'),
  ];
  return $perms;
}

/**
 * Implements hook_media_browser_plugin_info().
 */
function media_acquiadam_browser_media_browser_plugin_info() {
  $info = [];
  $info['acquiadam'] = [
    'title' => t('Acquia DAM'),
    'weight' => -100,
    'class' => 'AcquiaDAMMediaBrowserPlugin',
  ];
  return $info;
}

/**
 * Implements hook_help().
 */
function media_acquiadam_browser_help($path, $arg) {
  switch ($path) {
    case 'admin/help#media_acquiadam_browser':
      $output = '<h3>' . t('About Media: Acquia DAM Browser') . '</h3>';
      $output .= '<p>' . t('Provides a Media Browser interface that allows users to browse assets from within the Drupal files page and on fields that use the Media style widget.') . '</p>';
      return $output;
  }
}

/**
 * Implements hook_image_default_styles().
 */
function media_acquiadam_browser_image_default_styles() {
  $styles = [];
  $styles['media_acquiadam_browser_preview_medium'] = [
    'label' => t('AcquiaDAM Medium Preview'),
    'effects' => [
      [
        'name' => 'image_scale',
        'data' => [
          'width' => 150,
          'height' => 150,
          'upscale' => FALSE,
        ],
        'weight' => 0,
      ],
    ],
  ];
  return $styles;
}