You are here

function hook_filefield_paths_field_settings in File (Field) Paths 8

Same name and namespace in other branches
  1. 7 filefield_paths.api.php \hook_filefield_paths_field_settings()

Form settings hook.

Define field(s) to be displayed on the File (Field) Paths settings form and used during the processing of uploaded files.

Parameters

$field: The field definition this File (Field) Paths settings field applies to.

$instance: The field instance this File (Field) Paths settings field applies to.

Return value

array An array whose keys are field names and whose values are arrays defining the field, with the following key/value pairs:

  • title: The title fo the field.
  • form: A keyed array of Form API elements.

See also

hook_filefield_paths_process_file()

1 function implements hook_filefield_paths_field_settings()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

filefield_paths_filefield_paths_field_settings in ./filefield_paths.inc
Implements hook_filefield_paths_field_settings().
1 invocation of hook_filefield_paths_field_settings()
filefield_paths_form_field_config_edit_form_alter in ./filefield_paths.module
Implements hook_form_FORM_ID_alter().

File

./filefield_paths.api.php, line 27
Hooks provided by the File (Field) Paths module.

Code

function hook_filefield_paths_field_settings($field, $instance) {
  return [
    'file_path' => [
      'title' => 'File path',
      'form' => [
        'value' => [
          '#type' => 'textfield',
          '#title' => t('File path'),
          '#maxlength' => 512,
          '#size' => 128,
          '#element_validate' => [
            '_file_generic_settings_file_directory_validate',
          ],
          '#default_value' => $instance['settings']['file_directory'],
        ],
      ],
    ],
  ];
}