Form submission handler for rest_admin_form().
function rest_admin_form_submit($form, &$form_state) {
$resources = array_filter($form_state['values']['entity_resources']);
if (!empty($form_state['values']['other_resources'])) {
$resources += array_filter($form_state['values']['other_resources']);
}
$config = config('rest');
$config
->set('resources', $resources);
$config
->save();
// Rebuild routing cache.
drupal_container()
->get('router.builder')
->rebuild();
}