services.install in Services 8.4
Same filename and directory in other branches
The installation implementation for the services module.
File
services.installView source
<?php
/**
* @file
* The installation implementation for the services module.
*/
use Drupal\Core\Config\Config;
/**
* Migrate endpoint service providers to service resources.
*/
function service_update_8001() {
$config_factory = \Drupal::configFactory();
foreach ($config_factory
->listAll('services.service_endpoint.') as $name) {
$config = $config_factory
->getEditable($name);
if (!$config instanceof Config) {
continue;
}
$data = $config
->getRawData();
if (!isset($data['service_providers']) || empty($data['service_providers'])) {
continue;
}
foreach ($data['service_providers'] as $plugin_id) {
\Drupal::entityTypeManager()
->getStorage('service_endpoint_resource')
->create([
'service_plugin_id' => $plugin_id,
'service_endpoint_id' => $data['id'],
])
->save();
}
unset($data['service_providers']);
$config
->setData($data)
->save();
}
}
Functions
Name | Description |
---|---|
service_update_8001 | Migrate endpoint service providers to service resources. |