You are here

function entity_metadata_system_get_properties in Entity API 7

Callback for getting site-wide properties.

See also

entity_metadata_system_entity_info_alter()

1 string reference to 'entity_metadata_system_get_properties'
entity_metadata_system_entity_property_info in modules/system.info.inc
Implements hook_entity_property_info() on top of system module.

File

modules/callbacks.inc, line 236
Provides various callbacks for the whole core module integration.

Code

function entity_metadata_system_get_properties($data, array $options, $name) {
  switch ($name) {
    case 'name':
      return variable_get('site_name', 'Drupal');
    case 'url':
      return url('<front>', $options);
    case 'login_url':
      return url('user', $options);
    case 'current_user':
      return $GLOBALS['user']->uid ? $GLOBALS['user']->uid : drupal_anonymous_user();
    case 'current_date':
      return REQUEST_TIME;
    case 'current_page':

      // Subsequent getters of the struct retrieve the actual values.
      return array();
    default:
      return variable_get('site_' . $name, '');
  }
}