You are here

function mathfield_mathfield_get_token_number_alter in Math Field 7

Implements hook_mathfield_get_token_MODULE_alter() for the number.module.

Related topics

File

./mathfield.module, line 684
Adds a dynamic math expression field.

Code

function mathfield_mathfield_get_token_number_alter(&$data, $context) {
  if (empty($data)) {
    $field_name = $context['field']['field_name'];
    $name = strtr('@field_name[@parts]', array(
      '@field_name' => $field_name,
      '@parts' => implode('][', array(
        $context['element']['#language'],
        $context['delta'],
        $context['column'],
      )),
    ));
    $data = array(
      'selector' => 'input[name="' . $name . '"]',
      'event' => 'blur',
    );
  }
}