You are here

commerce_shipping_weight_tariff.module in Commerce Shipping Weight Tariff 8

Contains Drupal hooks.

File

commerce_shipping_weight_tariff.module
View source
<?php

/**
 * @file
 * Contains Drupal hooks.
 */
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements commerce_shipping_method_form alter.
 *
 * @param array $form
 *   Form elements array.
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *   Form state object.
 * @param mixed $form_id
 *   The form id.
 */
function commerce_shipping_weight_tariff_form_commerce_shipping_method_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  $form['#attached']['library'][] = 'commerce_shipping_weight_tariff/condition_states_logic';
}

/**
 * Implements hook_help().
 */
function commerce_shipping_weight_tariff_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the commerce_shipping_weight_tariff module.
    case 'help.page.commerce_shipping_weight_tariff':
      $path = __DIR__ . '/README.txt';
      if (file_exists($path)) {
        $readme = file_get_contents($path);
      }
      if (!isset($readme)) {
        return NULL;
      }
      return '<pre>' . $readme . '</pre>';
  }
}

Functions