field_orbit.module in ZURB Orbit 8
Same filename and directory in other branches
Implement a orbit formatter for fields.
File
field_orbit.moduleView source
<?php
/**
 * @file
 * Implement a orbit formatter for fields.
 */
use Drupal\Core\Routing\RouteMatchInterface;
/**
 * Implements hook_theme().
 */
function field_orbit_theme($existing, $type, $theme, $path) {
  return [
    'field_orbit' => [
      'variables' => [
        'image' => NULL,
        'items' => NULL,
        'options' => NULL,
        'entity' => NULL,
        'orbit_id' => NULL,
      ],
      'template' => 'field-orbit',
    ],
  ];
}
/**
 * Implements template_preprocess().
 */
function template_preprocess_field_orbit(&$variables) {
  if (count($variables['options'])) {
    $variables['data_options'] = '';
    foreach ($variables['options'] as $key => $value) {
      if (strlen($value)) {
        $variables['data_options'] .= $key . ': ' . str_replace("'", '', $value) . '; ';
      }
    }
  }
}
/**
 * Implements hook_help().
 */
function field_orbit_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.field_orbit':
      $output = '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('This module provides a slideshow display for image fields and field collections using the <a href=":orbit_url">plugin for Zurb Foundation 6.</a>', [
        ':orbit_url' => 'http://foundation.zurb.com/sites/docs/orbit.html',
      ]) . '</p>';
      return $output;
  }
}Functions
| 
            Name | 
                  Description | 
|---|---|
| field_orbit_help | Implements hook_help(). | 
| field_orbit_theme | Implements hook_theme(). | 
| template_preprocess_field_orbit | Implements template_preprocess(). |