protected function SavedSearchType::createFormDisplay in Search API Saved Searches 8
Creates a "create" form display for a new saved search bundle.
1 call to SavedSearchType::createFormDisplay()
- SavedSearchType::postSave in src/
Entity/ SavedSearchType.php - Acts on a saved entity before the insert or update hook is invoked.
File
- src/
Entity/ SavedSearchType.php, line 187
Class
- SavedSearchType
- Provides an entity type for configuring how searches can be saved.
Namespace
Drupal\search_api_saved_searches\EntityCode
protected function createFormDisplay() {
try {
$values = [
'status' => TRUE,
'id' => "search_api_saved_search.{$this->id()}.create",
'targetEntityType' => 'search_api_saved_search',
'bundle' => $this
->id(),
'mode' => 'create',
'content' => [
'label' => [
'type' => 'string_textfield',
'weight' => 0,
'region' => 'content',
'settings' => [
'size' => 60,
'placeholder' => '',
],
'third_party_settings' => [],
],
'notify_interval' => [
'type' => 'options_select',
'weight' => 1,
'region' => 'content',
'settings' => [],
'third_party_settings' => [],
],
],
'hidden' => [
'status' => TRUE,
'created' => TRUE,
'langcode' => TRUE,
'last_executed' => TRUE,
'next_execution' => TRUE,
'uid' => TRUE,
],
];
foreach ($this
->getNotificationPlugins() as $plugin) {
$values['content'] += $plugin
->getDefaultFieldFormDisplay();
}
EntityFormDisplay::create($values)
->save();
} catch (EntityStorageException $e) {
$vars = [
'%label' => $this
->label(),
];
watchdog_exception('search_api_saved_searches', $e, '%type while trying to configure the "Create" form display for the new saved search type %label: @message in %function (line %line of %file).', $vars);
}
}