You are here

social_link_field.module in Social Link Field 8

Module implementing social link field type.

File

social_link_field.module
View source
<?php

/**
 * @file
 * Module implementing social link field type.
 */

/**
 * Implements hook_theme().
 */
function social_link_field_theme() {
  return [
    'social_link_field_formatter' => [
      'variables' => [
        'links' => NULL,
        'new_tab' => NULL,
        'appearance' => NULL,
        'attributes' => NULL,
      ],
      'template' => 'social-link-field-formatter',
    ],
    'field_multiple_value_no_draggable_form' => [
      'render element' => 'element',
      'template' => 'field-multiple-value-form',
    ],
  ];
}

/**
 * Prepares variables for individual form element templates.
 *
 * Default template: field-multiple-value-form.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - element: A render element representing the form element.
 */
function social_link_field_preprocess_field_multiple_value_no_draggable_form(array &$variables) {
  template_preprocess_field_multiple_value_form($variables);
  unset($variables['table']['#header'][1]);
  unset($variables['table']['#tabledrag']);
  for ($i = 0; $i <= $variables['element']['#max_delta']; $i++) {
    unset($variables['table']['#rows'][$i]['class'][0]);
    unset($variables['table']['#rows'][$i]['data'][2]);
  }
}

Functions

Namesort descending Description
social_link_field_preprocess_field_multiple_value_no_draggable_form Prepares variables for individual form element templates.
social_link_field_theme Implements hook_theme().