function swagger_ui_formatter_field_formatter_settings_form in Swagger UI Field Formatter 7.2
Same name and namespace in other branches
- 7 swagger_ui_formatter.module \swagger_ui_formatter_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
swagger_ui_formatter.module, line 31 - 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_top_bar'] = array(
'#type' => 'checkbox',
'#title' => t('Show Top Bar'),
'#default_value' => $settings['show_top_bar'],
'#description' => t('Controls whether the Swagger UI top bar should be displayed or not.'),
);
$form['sort_tags_by_name'] = array(
'#type' => 'checkbox',
'#title' => t('Sort tags by name'),
'#default_value' => $settings['sort_tags_by_name'],
'#description' => t('Controls whether the tag groups should be ordered alphabetically or not.'),
);
return $form;
}