You are here

function domain_integration_entity_property_info_alter in Domain Integration (Drupal 7) 7

Same name and namespace in other branches
  1. 8 domain_integration.module \domain_integration_entity_property_info_alter()

Implements hook_entity_property_info_alter().

Adds domain access entity properties for node, user and site.

Available domain-properties are ( - domain_id (returns a list of integers)

  • subdomain (returns a list of text)
  • sitename (returns a list of text)
  • scheme (* not implemented *)
  • valid (* not implemented *)
  • weight (* not implemented *)
  • is_default (* not implemented *)
  • machine_name (returns a list of text)
  • path (returns a list of text)
  • site_grant (* not implemented *)

See also

domain_load($domain_id)):

File

./domain_integration.module, line 24
Domain Integration.

Code

function domain_integration_entity_property_info_alter(&$info) {

  // Domain properties.
  $domain_properties = array();
  $domain_properties['domain_domain_id'] = array(
    'label' => t('Domain ID'),
    'description' => t("A list of Domain ID's."),
    'type' => 'list<integer>',
    'getter callback' => 'domain_integration_get_domain_info',
    'entity views field' => TRUE,
  );
  $domain_properties['domain_subdomain'] = array(
    'label' => t('Domain Subdomain'),
    'description' => t("A list of Domain Subdomains (full url)."),
    'type' => 'list<text>',
    'getter callback' => 'domain_integration_get_domain_info',
    'entity views field' => TRUE,
  );
  $domain_properties['domain_sitename'] = array(
    'label' => t('Domain Sitename'),
    'description' => t("A list of Domain Sitenames (readable, perfect for search filters)."),
    'type' => 'list<text>',
    'getter callback' => 'domain_integration_get_domain_info',
    'entity views field' => TRUE,
  );
  $domain_properties['domain_machine_name'] = array(
    'label' => t('Domain Machine name'),
    'description' => t("A list of Domain Machine names (perfect for string comparisons)."),
    'type' => 'list<text>',
    'getter callback' => 'domain_integration_get_domain_info',
    'entity views field' => TRUE,
  );
  $domain_properties['domain_path'] = array(
    'label' => t('Domain Path'),
    'description' => t("A list of Domain Paths (full url including http://)."),
    'type' => 'list<text>',
    'getter callback' => 'domain_integration_get_domain_info',
    'entity views field' => TRUE,
  );

  // Node Domain properties.
  $info['node']['properties'] = $info['node']['properties'] + $domain_properties;

  // Add 'send to all' property for nodes.
  $info['node']['properties']['domain_domain_site'] = array(
    'label' => t('Domain Send to All'),
    'description' => t('A boolean that is TRUE if Send to All is set'),
    'type' => 'boolean',
    'getter callback' => 'domain_integration_get_domain_info',
    'entity views field' => TRUE,
  );

  // User Domain properties.
  $info['user']['properties'] = $info['user']['properties'] + $domain_properties;

  // Site Domain properties.
  $info['site']['properties'] = $info['site']['properties'] + $domain_properties;
}