You are here

fiu.module in Fine Image Upload 8

Same filename and directory in other branches
  1. 8.2 fiu.module

File

fiu.module
View source
<?php

/**
 * @file
 * Load all Field module hooks for Image.
 */
require_once __DIR__ . '/fiu.field.inc';

/**
 * Implements hook_theme().
 */
function fiu_theme() {
  return [
    // Theme functions in fiu.field.inc.
    'fine_image_widget' => [
      'render element' => 'element',
      'file' => 'fiu.field.inc',
    ],
    'fine_image_widget_unitary' => [
      'render element' => 'element',
      'file' => 'fiu.field.inc',
    ],
    'fine_image_widget_multiple' => [
      'render element' => 'element',
      'file' => 'fiu.field.inc',
    ],
  ];
}

/**
 * Add new supported IMCE widget.
 */
function fiu_imce_supported_widgets_alter(&$widgets) {
  $widgets[] = 'fine_image';
}

/**
 * Implements hook_filefield_sources_widgets().
 */
function fiu_filefield_sources_widgets() {
  return [
    'fine_image',
  ];
}

/**
 * Implements hook_theme_registry_alter().
 */
function fiu_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['filefield_sources_list'])) {
    $theme_registry['filefield_sources_list']['function'] = 'fiu_filefield_sources_list';
  }
}

/**
 * Override filefield_sources_list theme.
 */
function fiu_filefield_sources_list($variables) {
  $element = $variables['element'];
  $sources = $variables['sources'];
  $links = array();
  foreach ($sources as $name => $source) {
    $links[] = '<a href="#" onclick="return false;" title="' . $source['description'] . '" id="' . $element['#id'] . '-' . $name . '-source" class="filefield-source filefield-source-' . $name . '">' . $source['label'] . '</a>';
  }
  return '<div class="filefield-sources-list">' . implode('', $links) . '</div>';
}

Functions

Namesort descending Description
fiu_filefield_sources_list Override filefield_sources_list theme.
fiu_filefield_sources_widgets Implements hook_filefield_sources_widgets().
fiu_imce_supported_widgets_alter Add new supported IMCE widget.
fiu_theme Implements hook_theme().
fiu_theme_registry_alter Implements hook_theme_registry_alter().