You are here

function sarnia_entity_type_load_by_index in Sarnia 7

Same name in this branch
  1. 7 sarnia.api.php \sarnia_entity_type_load_by_index()
  2. 7 sarnia.module \sarnia_entity_type_load_by_index()

Load Sarnia entity type info given a Search API index machine name.

This function works on the assumption that there will be a single Search API index for a particular Sarnia entity type.

Parameters

string $index_machine_name: The machine name of a Search API index.

Return value

array Bundle information, or FALSE if there is no Sarnia entity type associated with the given Search API index.

7 calls to sarnia_entity_type_load_by_index()
SarniaSolrService::getFieldNames in ./service.inc
Create a list of all indexed field names mapped to their Solr field names. The special fields "search_api_id" and "search_api_relevance" are also included.
SarniaViewsHandlerArgumentId::title in handlers/handler_argument_id.inc
If the name solr property is not the id, load the sarnia entity and extract the name property.
SarniaViewsHandlerField::init in handlers/handler_field.inc
Initialize the handler and load Sarnia entity type info.
sarnia_entity_load in ./sarnia.module
Implements hook_entity_load().
sarnia_facetapi_facet_info_alter in ./sarnia.module
Implements hook_facetapi_info_alter().

... See full list

File

./sarnia.module, line 245

Code

function sarnia_entity_type_load_by_index($index_machine_name) {
  foreach (sarnia_entity_types() as $entity_type) {
    if ($entity_type['search_api_index'] == $index_machine_name) {
      return $entity_type;
    }
  }
  return FALSE;
}