You are here

function search_api_saved_searches_entity_field_storage_info in Search API Saved Searches 8

Implements hook_entity_field_storage_info().

File

./search_api_saved_searches.module, line 75
Allows visitors to bookmark searches and get notifications for new results.

Code

function search_api_saved_searches_entity_field_storage_info(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() !== 'search_api_saved_search') {
    return [];
  }

  // Add field storage definitions for all notification plugin-provided fields.
  $fields = [];
  $bundles = \Drupal::getContainer()
    ->get('entity_type.bundle.info')
    ->getBundleInfo('search_api_saved_search');
  foreach (array_keys($bundles) as $bundle) {

    // We don't use the $base_field_definitions parameter in that method, so no
    // need to retrieve those for passing them here.
    $fields += SavedSearch::bundleFieldDefinitions($entity_type, $bundle, []);
  }
  return $fields;
}