You are here

function name_example_names in Name Field 7

Helper function to provide a list of example name components.

Parameters

array $excluded_components: This will empty (set to "") any specified values.

2 calls to name_example_names()
name_field_formatter_settings_summary in ./name.module
Implements hook_field_formatter_settings_summary().
name_list_custom_formats in ./name.admin.inc
Lists the known custom formats.
1 string reference to 'name_example_names'
name_uninstall in ./name.install
Implements hook_uninstall().

File

./name.admin.inc, line 185
General administration functions.

Code

function name_example_names($excluded_components = array(), $field_name = NULL) {
  $example_names = array(
    1 => array(
      'title' => 'Mr',
      'given' => 'Joe',
      'middle' => 'John Peter Mark',
      'family' => 'Doe',
      'generational' => 'Jnr.',
      'credentials' => 'B.Sc., Ph.D.',
    ),
    2 => array(
      'title' => '',
      'given' => 'JOAN',
      'middle' => 'SUE',
      'family' => 'DOE',
      'generational' => '',
      'credentials' => '',
    ),
    3 => array(
      'title' => '',
      'given' => 'Prince',
      'middle' => '',
      'family' => '',
      'generational' => '',
      'credentials' => '',
    ),
  );
  $example_names = variable_get('name_example_names', $example_names);
  if (isset($field_name)) {
    $example_names = variable_get('name_example_names_' . $field_name, $example_names);
  }
  foreach ($example_names as $delta => $example_name) {
    foreach ($example_name as $component => $value) {
      if (in_array($component, $excluded_components)) {
        $example_names[$delta][$component] = '';
      }
    }
  }
  return $example_names;
}