public static function Imce::settings in FileField Sources 8
Implements hook_filefield_source_settings().
File
- src/
Plugin/ FilefieldSource/ Imce.php, line 179
Class
- Imce
- A FileField source plugin to allow referencing of files from IMCE.
Namespace
Drupal\filefield_sources\Plugin\FilefieldSourceCode
public static function settings(WidgetInterface $plugin) {
$settings = $plugin
->getThirdPartySetting('filefield_sources', 'filefield_sources', [
'source_imce' => [
'imce_mode' => 0,
],
]);
$return['source_imce'] = [
'#title' => t('IMCE file browser settings'),
'#type' => 'details',
'#access' => \Drupal::moduleHandler()
->moduleExists('imce'),
];
// $imce_admin_url = \Drupal::url('imce.admin');.
$imce_admin_url = 'admin/config/media/imce';
$return['source_imce']['imce_mode'] = [
'#type' => 'radios',
'#title' => t('File browser mode'),
'#options' => [
0 => t('Restricted: Users can only browse the field directory. No file operations are allowed.'),
1 => t('Full: Browsable directories are defined by <a href=":imce-admin-url">IMCE configuration profiles</a>. File operations are allowed.', [
':imce-admin-url' => $imce_admin_url,
]),
],
'#default_value' => isset($settings['source_imce']['imce_mode']) ? $settings['source_imce']['imce_mode'] : 0,
];
return $return;
}