function name_get_format_by_machine_name in Name Field 7
Same name and namespace in other branches
- 8 name.module \name_get_format_by_machine_name()
- 6 name.module \name_get_format_by_machine_name()
Loads a format based on the machine name.
Parameters
string $machine_name:
Return value
string The name format.
6 calls to name_get_format_by_machine_name()
- name_field_diff_view in ./
name.diff.inc - Diff field callback for parsing name field comparative values.
- name_field_formatter_settings_summary in ./
name.module - Implements hook_field_formatter_settings_summary().
- name_field_formatter_view in ./
name.module - Implements hook_field_formatter_view().
- name_tokens in ./
name.tokens.inc - Implements hook_tokens().
- name_user_load in ./
name.module - Implements hook_user_load().
1 string reference to 'name_get_format_by_machine_name'
- name_custom_formats_form_submit in ./
name.admin.inc - Submit handler for name_custom_formats_form().
File
- ./
name.module, line 333 - Defines an API for displaying and inputing names.
Code
function name_get_format_by_machine_name($machine_name) {
static $drupal_static_fast;
if (!isset($drupal_static_fast)) {
$drupal_static_fast['formats'] =& drupal_static(__FUNCTION__);
}
$formats =& $drupal_static_fast['formats'];
if (!isset($formats[$machine_name])) {
if ($machine_name == 'default') {
$formats[$machine_name] = name_settings('default_format');
}
else {
$formats[$machine_name] = (string) db_query("SELECT format FROM {name_custom_format} WHERE machine_name = :machine_name", array(
':machine_name' => $machine_name,
))
->fetchField();
}
}
return $formats[$machine_name];
}