You are here

function _auto_entitylabel_get_settings in Automatic Entity Label 7

Function to get settings.

4 calls to _auto_entitylabel_get_settings()
auto_entitylabel_exit in ./auto_entitylabel.module
Implements hook_exit().
auto_entitylabel_is_needed in ./auto_entitylabel.module
Returns whether the auto entitylabel has to be set on the provided entity.
auto_entitylabel_set_title in ./auto_entitylabel.module
Sets the automatically generated entitylabel for the entity.
_auto_entitylabel_patternprocessor in ./auto_entitylabel.module
Helper function to generate the title according to the settings.

File

./auto_entitylabel.module, line 501
Allows hiding of entity label fields and automatic label creation.

Code

function _auto_entitylabel_get_settings($entity, $entity_type) {
  $entity_info = entity_get_info($entity_type);
  if ($entity_info['entity keys']['bundle'] && !empty($entity)) {
    $result['key'] = $entity_type . '_' . $entity->{$entity_info['entity keys']['bundle']};
    $result['title'] = isset($entity_info['entity keys']['label']) ? $entity_info['entity keys']['label'] : 'none';
    return $result;
  }
  return FALSE;
}