visualn-8.x-1.x-dev/modules/visualn_file_field/visualn_file_field.module

modules/visualn_file_field/visualn_file_field.module
<?php

/**
 * @file
 * Contains visualn_file_field.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function visualn_file_field_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the visualn_file_field module.
    case 'help.page.visualn_file_field':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Enables VisualN support for files') . '</p>';
      return $output;

    default:
  }
}

/**
 * Implements hook_theme().
 */
function visualn_file_field_theme($existing, $type, $theme, $path) {
  return [
    'visualn_image_formatter' => [
      'variables' => [
        'image_items' => NULL,
        'visualn_drawing_build' => NULL,
        'label' => NULL,
        'element' => NULL
      ],
    ],
  ];
}

function template_preprocess_visualn_image_formatter(&$variables, $hook) {
  // @todo: Get label and other variables for the template, see template_preprocess_field() for example.
}

/**
 * Implements hook_visualn_raw_resource_format_info_alter().
 */
function visualn_file_field_visualn_raw_resource_format_info_alter(&$definitions) {
  // @todo: disable visualn_xml (at least temporarily until fixed)
  $ids = ['visualn_json', 'visualn_csv', 'visualn_tsv'];
  //$ids = ['visualn_json', 'visualn_csv', 'visualn_tsv', 'visualn_xml'];
  // @todo: maybe add directly to plugins annotation
  foreach ($definitions as $k => $definition) {
    if (in_array($definition['id'], $ids)) {
      $definitions[$k]['groups'][] = 'visualn_file_widget';
    }
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc