You are here

signaturefield.module in SignatureField 1.x

Main module file.

File

signaturefield.module
View source
<?php

/**
 * @file
 * Main module file.
 */

/**
 * Implements hook_theme().
 */
function signaturefield_theme($existing, $type, $theme, $path) {
  return [
    'signature_canvas' => [
      'variables' => [
        'id' => NULL,
        'width' => NULL,
        'height' => NULL,
      ],
    ],
  ];
}

/**
 * Prepare the variables for the signature canvas template.
 *
 * @param array $variables
 *   An associative array of variables:
 *   - id: the canvas ID.
 *   - width: the canvas width in pixels.
 *   - height: the canvas height in pixels.
 */
function template_preprocess_signature_canvas(array &$variables) {
  $variables['attributes']['id'] = $variables['id'];
  $variables['attributes']['style'] = 'width: ' . $variables['width'] . 'px; height: ' . $variables['height'] . 'px;';
}

Functions

Namesort descending Description
signaturefield_theme Implements hook_theme().
template_preprocess_signature_canvas Prepare the variables for the signature canvas template.