function filefield_source_elfinder_process in elFinder file manager 6
Same name and namespace in other branches
- 8.2 modules/elfinder_ffsel/elfinder_ffsel.module \filefield_source_elfinder_process()
- 6.2 modules/elfinder_ffsel/elfinder_ffsel.module \filefield_source_elfinder_process()
- 7.3 modules/elfinder_ffsel/elfinder_ffsel.module \filefield_source_elfinder_process()
- 7 modules/elfinder_ffsel/elfinder_ffsel.module \filefield_source_elfinder_process()
- 7.2 modules/elfinder_ffsel/elfinder_ffsel.module \filefield_source_elfinder_process()
A #process callback to extend the filefield_widget element type.
1 string reference to 'filefield_source_elfinder_process'
- filefield_source_elfinder_info in modules/
elfinder_ffsel/ elfinder_ffsel.module - Implementation of hook_filefield_source_info().
File
- modules/
elfinder_ffsel/ elfinder_ffsel.module, line 93
Code
function filefield_source_elfinder_process($element, $edit, &$form_state, $form) {
$field = content_fields($element['#field_name'], $element['#type_name']);
$element['filefield_elfinder'] = array(
'#weight' => 100.5,
'#access' => empty($element['fid']['#value']),
'#theme' => 'filefield_source_elfinder_element',
'#filefield_source' => TRUE,
// Required for proper theming.
'#description' => filefield_sources_element_validation_help($element['#upload_validators']),
);
$filepath_id = $element['#id'] . '-elfinder-path';
$display_id = $element['#id'] . '-elfinder-display';
$select_id = $element['#id'] . '-elfinder-select';
$element['filefield_elfinder']['file_path'] = array(
'#type' => 'hidden',
'#value' => '',
'#id' => $filepath_id,
'#attributes' => array(
'onchange' => "if (!jQuery('#{$select_id}').attr('disabled')) { jQuery('#{$select_id}').mousedown(); jQuery('#{$display_id}').html(this.value); }",
),
);
$elfinder_function = 'window.open(\'' . url('elfinder', array(
'query' => array(
'app' => 'ffs',
'field_name' => $element['#field_name'],
'filepath_id' => $filepath_id,
'select_id' => $select_id,
),
)) . '\', \'\', \'width=760,height=560,resizable=1\'); return false;';
$element['filefield_elfinder']['display_path'] = array(
'#type' => 'markup',
'#value' => '<span id="' . $display_id . '" class="filefield-sources-elfinder-display">' . t('No file selected') . '</span> (<a class="filefield-sources-elfinder-browse" href="#" onClick="' . $elfinder_function . '">' . t('browse') . '</a>)',
);
$element['filefield_elfinder']['select'] = array(
'#type' => 'submit',
'#value' => t('Select'),
'#submit' => array(
'node_form_submit_build_node',
),
'#name' => $element['#name'] . '[filefield_elfinder][button]',
'#id' => $select_id,
'#attributes' => array(
'style' => 'display: none;',
),
'#ahah' => array(
'path' => 'filefield/ahah/' . $element['#type_name'] . '/' . $element['#field_name'] . '/' . $element['#delta'],
'wrapper' => $element['#id'] . '-ahah-wrapper',
'method' => 'replace',
'effect' => 'fade',
),
);
return $element;
}