Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
novicell/dds_dawa / dds_dawa.module
Size: Mime:
<?php

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_theme().
 */
function dds_dawa_theme() {
  return [
    'dawa_address' => [
      'variables' => [
        'id' => NULL,
        'data' => NULL,
        'view' => NULL,
        'show_country' => TRUE
      ],
    ],
    'dawa_address__inline' => [
      'base hook' => 'dawa_address',
    ],
    'dawa_address__leaflet' => [
      'base hook' => 'dawa_address',
      'variables' => [
        'leaflet' => NULL,
      ],
    ],
    'form_element__dawa_autocomplete' => [
      'base hook' => 'form_element',
    ],
  ];
}

/**
 * Implements hook_help().
 */
function dds_dawa_fields_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.dds_dawa':
      return 'Adds API service for DAWA and address autocomplete fields.';
  }
}

/**
 * Implements hook_locale_translation_projects_alter().
 */
function dds_dawa_locale_translation_projects_alter(&$projects) {
  $module_handler = \Drupal::service('module_handler');
  $path = $module_handler->getModule('dds_dawa')->getPath();
  $projects['dds_dawa']['info']['interface translation server pattern'] = $path.'/translations/%language.po';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function dds_dawa_theme_suggestions_form_element_alter(array &$suggestions, array $variables) {
  if (!empty($variables['element']['#wrapper_attributes']['data-type']) && $variables['element']['#wrapper_attributes']['data-type'] === 'dawa-autocomplete') {
    $suggestions[] = $variables['theme_hook_original']. '__dawa_autocomplete';
  }
}