protected function SearchApiAbstractDataSourceController::getPropertyInfo in Search API 7
Retrieves the property info for this item type.
This is a helper method for getMetadataWrapper() that can be used by subclasses to specify the property information to use when creating a metadata wrapper.
The data structure uses largely the format specified in hook_entity_property_info(). However, the first level of keys (containing the entity types) is omitted, and the "properties" key is called "property info" instead. So, an example return value would look like this:
return array(
'property info' => array(
'foo' => array(
'label' => t('Foo'),
'type' => 'text',
),
'bar' => array(
'label' => t('Bar'),
'type' => 'list<integer>',
),
),
);
SearchApiExternalDataSourceController::getPropertyInfo() contains a working example of this method.
If the item type is an entity type, no additional property information is required, the method will thus just return an empty array. You can still use this to append additional properties to the entities, or the like, though.
Return value
array Property information as specified by entity_metadata_wrapper().
Throws
SearchApiDataSourceException If any error state was encountered.
See also
getMetadataWrapper()
1 call to SearchApiAbstractDataSourceController::getPropertyInfo()
- SearchApiAbstractDataSourceController::getMetadataWrapper in includes/
datasource.inc - Creates a metadata wrapper for this datasource controller's type.
2 methods override SearchApiAbstractDataSourceController::getPropertyInfo()
- SearchApiCombinedEntityDataSourceController::getPropertyInfo in includes/
datasource_multiple.inc - Retrieves the property info for this item type.
- SearchApiExternalDataSourceController::getPropertyInfo in includes/
datasource_external.inc - Overrides SearchApiAbstractDataSourceController::getPropertyInfo().
File
- includes/
datasource.inc, line 507 - Contains the SearchApiDataSourceControllerInterface as well as a default base class.
Class
- SearchApiAbstractDataSourceController
- Provides a default base class for datasource controllers.
Code
protected function getPropertyInfo() {
// If this is an entity type, no additional property info is needed.
if ($this->entityType) {
return array();
}
throw new SearchApiDataSourceException(t('No known property information for type @type.', array(
'@type' => $this->type,
)));
}