You are here

function twig_tools_help in Twig Tools 8

Implements hook_help().

File

./twig_tools.module, line 13
Provides additional Twig filters and functions.

Code

function twig_tools_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the twig_tools module.
    case 'help.page.twig_tools':
      $output = '';
      $output .= '<h3>' . t('About Twig Tools') . '</h3>';
      $output .= '<p>' . t('The Twig Tools module provides additional Twig filters and functions.') . '</p>';
      $output .= '<h4>' . t('Sanitization Filters:') . '</h4>';
      $output .= '<dl>';
      $output .= '<dt><code>clean_class_array</code></dt>';
      $output .= '<dd>' . t('Sanitizes all strings in an array for use as valid class names.') . '</dd>';
      $output .= '<dt><code>array_unique</code></dt>';
      $output .= '<dd>' . t('Filters all non-unique values from an array.') . '</dd>';
      $output .= '<dt><code>remove_empty</code></dt>';
      $output .= '<dd>' . t('Removes all falsy values from an array.') . '</dd>';
      $output .= '<dt><code>scrub_class_array</code></dt>';
      $output .= '<dd>' . t('Runs an array through all three Twig Tools sanitization filters.') . '</dd>';
      $output .= '</dl>';
      $output .= '<h4>' . t('Conversion Filters:') . '</h4>';
      $output .= '<dl>';
      $output .= '<dt><code>boolean</code></dt>';
      $output .= '<dd>' . t('Returns the boolean value of a passed variable.') . '</dd>';
      $output .= '<dt><code>integer</code></dt>';
      $output .= '<dd>' . t('Returns the integer value of a passed variable.') . '</dd>';
      $output .= '<dt><code>float</code></dt>';
      $output .= '<dd>' . t('Returns the float value of a passed variable.') . '</dd>';
      $output .= '<dt><code>string</code></dt>';
      $output .= '<dd>' . t('Returns the string value of a passed variable.') . '</dd>';
      $output .= '<dt><code>md5</code></dt>';
      $output .= '<dd>' . t('Returns the md5 hash value of a passed variable.') . '</dd>';
      $output .= '<dt><code>json_decode</code></dt>';
      $output .= '<dd>' . t('Decodes a JSON string into an array or object. Essentially the opposite of the built-in <code>json_encode</code> filter.') . '</dd>';
      $output .= '</dl>';
      $output .= '<h4>' . t('Color Filters:') . '</h4>';
      $output .= '<dl>';
      $output .= '<dt><code>rgb_to_hex</code></dt>';
      $output .= '<dd>' . t('Returns the hexadecimal color value of an RGB array of values.') . '</dd>';
      $output .= '<dt><code>css_rgb_to_hex</code></dt>';
      $output .= '<dd>' . t('Returns the hexadecimal color value of a passed CSS RGB color string.') . '</dd>';
      $output .= '<dt><code>hex_to_rgb</code></dt>';
      $output .= '<dd>' . t('Returns an array of equivalent RGB values of the passed hexadecimal color.') . '</dd>';
      $output .= '<dt><code>hex_to_css_rgb</code></dt>';
      $output .= '<dd>' . t('Returns the CSS RGB string equivalent of the passed hexadecimal color.') . '</dd>';
      $output .= '</dl>';
      return $output;
    default:
  }
}