Commit 268e3cb2 authored by webchick's avatar webchick
Browse files

Issue #1858676 by heyrocker, sun, Damien Tournoud: Fixed Rest module config is...

Issue #1858676 by heyrocker, sun, Damien Tournoud: Fixed Rest module config is named improperly and no default config is supplied.
parent 764d77a4
......@@ -55,7 +55,7 @@ public function dynamicRoutes(RouteBuildEvent $event) {
$collection = $event->getRouteCollection();
$resources = $this->config->get('rest')->load()->get('resources');
$resources = $this->config->get('rest.settings')->load()->get('resources');
if ($resources && $enabled = array_intersect_key($this->manager->getDefinitions(), $resources)) {
foreach ($enabled as $key => $resource) {
$plugin = $this->manager->getInstance(array('id' => $key));
......
......@@ -161,7 +161,7 @@ protected function entityValues($entity_type) {
*/
protected function enableService($resource_type) {
// Enable web API for this entity type.
$config = config('rest');
$config = config('rest.settings');
if ($resource_type) {
$config->set('resources', array(
$resource_type => $resource_type,
......
......@@ -26,7 +26,7 @@ function rest_admin_form($form, &$form_state) {
}
asort($entity_resources);
asort($other_resources);
$enabled_resources = config('rest')->get('resources') ?: array();
$enabled_resources = config('rest.settings')->get('resources') ?: array();
$form['entity_resources'] = array(
'#type' => 'checkboxes',
......@@ -55,7 +55,7 @@ function rest_admin_form_submit($form, &$form_state) {
$resources += array_filter($form_state['values']['other_resources']);
}
$config = config('rest');
$config = config('rest.settings');
$config->set('resources', $resources);
$config->save();
......
......@@ -30,7 +30,7 @@ function rest_permission() {
$permissions = array();
if (drupal_container()->has('plugin.manager.rest')) {
$manager = drupal_container()->get('plugin.manager.rest');
$resources = config('rest')->get('resources');
$resources = config('rest.settings')->get('resources');
if ($resources && $enabled = array_intersect_key($manager->getDefinitions(), $resources)) {
foreach ($enabled as $key => $resource) {
$plugin = $manager->getInstance(array('id' => $key));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment