You are here

public function Email::getFieldDefinitions in Search API Saved Searches 8

Retrieves the field definitions to add to saved searches for this plugin.

The field definitions will be added to all bundles for which this notification plugin is active.

If an existing plugin's field definitions change in any way, it is the providing module's responsibility to provide an update hook calling field storage definition listener's CRUD methods as appropriate.

Return value

\Drupal\search_api_saved_searches\BundleFieldDefinition[] An array of bundle field definitions, keyed by field name.

Overrides NotificationPluginBase::getFieldDefinitions

File

src/Plugin/search_api_saved_searches/notification/Email.php, line 324

Class

Email
Provides e-mails as a notification mechanism.

Namespace

Drupal\search_api_saved_searches\Plugin\search_api_saved_searches\notification

Code

public function getFieldDefinitions() {
  $fields['mail'] = BundleFieldDefinition::create('email')
    ->setLabel(t('E-mail'))
    ->setDescription(t('The email address to which notifications should be sent.'))
    ->setDefaultValueCallback(static::class . '::getDefaultMail')
    ->setRequired(TRUE)
    ->setDisplayOptions('view', [
    'type' => 'timestamp',
    'weight' => 0,
  ])
    ->setDisplayOptions('form', [
    'type' => 'datetime_timestamp',
    'weight' => 10,
  ])
    ->setDisplayConfigurable('form', TRUE);
  return $fields;
}