function geocoder_update_8301 in Geocoder 8.3
Installs the new config entity type geocoder_provider.
File
- ./
geocoder.install, line 27 - Install, update, and uninstall functions for geocoder.
Code
function geocoder_update_8301() {
$changeList = \Drupal::entityDefinitionUpdateManager()
->getChangeList();
if (!array_key_exists('geocoder_provider', $changeList)) {
return 'Skipped. The new config entity type geocoder_provider is already installed.';
}
try {
\Drupal::entityDefinitionUpdateManager()
->installEntityType(new ConfigEntityType([
'id' => 'geocoder_provider',
'label' => new TranslatableMarkup('Geocoder provider'),
'handlers' => [
'list_builder' => 'Drupal\\geocoder\\GeocoderProviderListBuilder',
'form' => [
'add' => 'Drupal\\geocoder\\Form\\GeocoderProviderAddForm',
'edit' => 'Drupal\\geocoder\\Form\\GeocoderProviderEditForm',
'delete' => 'Drupal\\Core\\Entity\\EntityDeleteForm',
],
],
'config_prefix' => 'geocoder_provider',
'admin_permission' => 'administer site configuration',
'links' => [
'collection' => '/admin/config/system/geocoder/geocoder-provider',
'edit-form' => '/admin/config/system/geocoder/geocoder-provider/manage/{geocoder_provider}',
'delete-form' => '/admin/config/system/geocoder/geocoder-provider/manage/{geocoder_provider}/delete',
],
'entity_keys' => [
'id' => 'id',
'label' => 'label',
],
'config_export' => [
'id',
'label',
'plugin',
'configuration',
],
]));
} catch (\Exception $exception) {
throw new UpdateException($exception
->getMessage());
}
return 'Installed the new config entity type geocoder_provider.';
}