You are here

function name_get_format_by_machine_name in Name Field 8

Same name and namespace in other branches
  1. 6 name.module \name_get_format_by_machine_name()
  2. 7 name.module \name_get_format_by_machine_name()

Loads a format based on the machine name.

1 call to name_get_format_by_machine_name()
template_preprocess_name_item in ./name.theme.inc
Prepares variables for name_item template.

File

./name.module, line 310
Defines an API for displaying and inputing names.

Code

function name_get_format_by_machine_name($machine_name) {
  $entity = \Drupal::entityTypeManager()
    ->getStorage('name_format')
    ->load($machine_name);
  if ($entity) {
    return $entity
      ->get('pattern');
  }
  return NULL;
}