function swagger_ui_formatter_field_formatter_settings_form in Swagger UI Field Formatter 7
Same name and namespace in other branches
- 7.2 swagger_ui_formatter.module \swagger_ui_formatter_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
swagger_ui_formatter.module, line 30 - Swagger ui field formatter functionality.
Code
function swagger_ui_formatter_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$form = array();
$form['validator'] = array(
'#type' => 'select',
'#title' => t("Validator"),
'#description' => t("Default=Swagger.io's online validator, None= No validation, Custom=Provide a custom validator url"),
'#default_value' => $settings['validator'],
'#options' => array(
'default' => t('Default'),
'none' => t('None'),
'custom' => t('Custom'),
),
);
$form['validator_url'] = array(
'#type' => 'textfield',
'#title' => t("Validator URL"),
'#description' => t("The custom validator url to be used to validated the swagger files."),
'#default_value' => $settings['validator_url'],
'#states' => array(
'visible' => array(
':input[name="fields[' . $field['field_name'] . '][settings_edit_form][settings][validator]"]' => array(
'value' => 'custom',
),
),
),
);
$form['doc_expansion'] = array(
'#type' => 'select',
'#title' => t("Doc Expansion"),
'#description' => t("Controls how the API listing is displayed"),
'#default_value' => $settings['doc_expansion'],
'#options' => array(
'none' => t('Default'),
'list' => t('List - shows operations for each resource'),
'full' => t('Fully Expanded - shows operations and their details'),
),
);
$form['show_request_headers'] = array(
'#type' => 'checkbox',
'#title' => t("Show Request Headers"),
'#default_value' => $settings['show_request_headers'],
'#description' => t("Whether or not to show the headers that were sent when making a request via the 'Try it out!' option"),
);
return $form;
}