You are here

function services_views_view_resource_settings_form in Services Views 7

Services views resource (endpoint specific) views display whitelist form.

1 string reference to 'services_views_view_resource_settings_form'
services_views_view_resource_settings in ./services_views.module
Page callback for configuration page for a service endpoint's view resource.

File

./services_views.module, line 518
Provides a generic but powerful API for web services.

Code

function services_views_view_resource_settings_form($form, &$form_state, $endpoint_name) {
  $views = array();
  $prefix = "services_views_" . $endpoint_name;
  $is_whitelist = variable_get($prefix . '_white_list', 0);
  $display_exceptions = variable_get($prefix . "_view_displays", array());
  foreach (views_get_enabled_views() as $view_name => $view) {
    foreach ($view->display as $view_display_name => $display) {
      if ($display->display_plugin != 'services') {
        continue;
      }
      $views[$view_name . '|' . $view_display_name] = check_plain($view->human_name) . ': ' . check_plain($display->display_title);
    }
  }
  $form = array();
  $form[$prefix . "_white_list"] = array(
    '#type' => 'radios',
    '#title' => t('Filter method'),
    '#options' => array(
      "0" => t('All views displays except those checked'),
      "1" => t('Only the views displays checked'),
    ),
    '#default_value' => $is_whitelist,
  );
  $form[$prefix . "_view_displays"] = array(
    '#type' => 'checkboxes',
    '#title' => t('Views to filter'),
    '#options' => $views,
    '#default_value' => $display_exceptions,
  );
  return system_settings_form($form);
}