You are here

function masked_input_view_configured_definitions in Masked Input 7.2

Same name and namespace in other branches
  1. 8 masked_input.module \masked_input_view_configured_definitions()

Returns a build to render a preview of available mask definitions as a table.

1 call to masked_input_view_configured_definitions()
masked_input_field_widget_settings_form in ./masked_input.module
Implements hook_field_widget_settings_form().

File

./masked_input.module, line 254
Provides a form element, Field widget, and simple API for using the Masked Input jQuery plugin.

Code

function masked_input_view_configured_definitions() {

  // Get default masks.
  $rows = _masked_input_default_definitions();

  // Get configured masks.
  foreach (variable_get('masked_input_definitions', array()) as $definition) {
    $rows[] = array(
      array(
        'data' => $definition['character'],
      ),
      array(
        'data' => $definition['regex'],
      ),
      array(
        'data' => $definition['description'],
      ),
    );
  }
  $header = array(
    t('Character'),
    t('Regular expression'),
    t('Description'),
  );
  $build = array(
    '#theme' => 'table__masked_input_definitions',
    '#header' => $header,
    '#rows' => $rows,
  );
  return $build;
}