function rest_update_8201

Install the REST config entity type and fix old settings-based config.

See also

rest_post_update_create_rest_resource_config_entities()

File

core/modules/rest/rest.install, line 16

Code

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.