json_field-8.x-1.x-dev/json_field.module

json_field.module
<?php

/**
 * @file
 * Primary hook implementations for the JSON Field module.
 */

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * Implements hook_help().
 */
function json_field_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the json_field module.
    case 'help.page.json_field':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Provides a JSON field, widgets and a formatter, and Views integration.') . '</p>';
      return $output;

    default:
  }
}

/**
 * Implements hook_theme().
 */
function json_field_theme() {
  $theme = [];

  return $theme;
}

/**
 * Implements hook_field_info_alter().
 */
function json_field_field_info_alter(array &$info): void {
  // Allow module to work with versions of older versions of Drupal.
  if (\version_compare(\Drupal::VERSION, '10.1.9999', '<')) {
    foreach (['json', 'json_native', 'json_native_binary'] as $field_type) {
      if (empty($info[$field_type]['category'])) {
        $info[$field_type]['category'] = new TranslatableMarkup('JSON data');
      }
    }
  }
}

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

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