Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0
This commit is contained in:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
|
@ -5,6 +5,9 @@
|
|||
* Install, update and uninstall functions for the rest module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityType;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
|
||||
/**
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
|
@ -21,3 +24,73 @@ function rest_requirements($phase) {
|
|||
}
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @defgroup updates-8.1.x-to-8.2.x
|
||||
* @{
|
||||
* Update functions from 8.1.x to 8.2.x.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Install the REST config entity type and fix old settings-based config.
|
||||
*
|
||||
* @see rest_post_update_create_rest_resource_config_entities()
|
||||
*/
|
||||
function rest_update_8201() {
|
||||
\Drupal::entityDefinitionUpdateManager()->installEntityType(new ConfigEntityType([
|
||||
'id' => 'rest_resource_config',
|
||||
'label' => new TranslatableMarkup('REST resource configuration'),
|
||||
'config_prefix' => 'resource',
|
||||
'admin_permission' => 'administer rest resources',
|
||||
'label_callback' => 'getLabelFromPlugin',
|
||||
'entity_keys' => ['id' => 'id'],
|
||||
'config_export' => [
|
||||
'id',
|
||||
'plugin_id',
|
||||
'granularity',
|
||||
'configuration',
|
||||
],
|
||||
]));
|
||||
\Drupal::state()->set('rest_update_8201_resources', \Drupal::config('rest.settings')->get('resources'));
|
||||
\Drupal::configFactory()->getEditable('rest.settings')
|
||||
->clear('resources')
|
||||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-save all views with a REST display to add new auth defaults.
|
||||
*/
|
||||
function rest_update_8202() {
|
||||
$config_factory = \Drupal::configFactory();
|
||||
foreach ($config_factory->listAll('views.view.') as $view_config_name) {
|
||||
$save = FALSE;
|
||||
$view = $config_factory->getEditable($view_config_name);
|
||||
$displays = $view->get('display');
|
||||
foreach ($displays as $display_name => &$display) {
|
||||
if ($display['display_plugin'] == 'rest_export') {
|
||||
if (!isset($display['display_options']['auth'])) {
|
||||
$display['display_options']['auth'] = [];
|
||||
$save = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($save) {
|
||||
$view->set('display', $displays);
|
||||
$view->save(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable BC for EntityResource: continue to use permissions.
|
||||
*/
|
||||
function rest_update_8203() {
|
||||
$config_factory = \Drupal::configFactory();
|
||||
$rest_settings = $config_factory->getEditable('rest.settings');
|
||||
$rest_settings->set('bc_entity_resource_permissions', TRUE)
|
||||
->save(TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "defgroup updates-8.1.x-to-8.2.x".
|
||||
*/
|
||||
|
|
Reference in a new issue