The insert button by default is located in the first column of the table created by the core file module. I'd like to move it from this column to the last column next to the remove button for design purposes (All actions are in the same place). There doesn't seem to be an easy way to do this.

Comments

neRok’s picture

Title: Moving the insert button to a different column » Moving the insert button to the file operatings column
Issue summary: View changes

I was interested in this too, so did some investigating.
Line 238 of insert.module defines the widget button as '#type' => 'markup',
Around Line 860 of file.field.inc, which is part of theme_file_widget_multiple there is

    // Delay rendering of the buttons, so that they can be rendered later in the
    // "operations" column.
    $operations_elements = array();
    foreach (element_children($widget) as $sub_key) {
      if (isset($widget[$sub_key]['#type']) && $widget[$sub_key]['#type'] == 'submit') {
        hide($widget[$sub_key]);
        $operations_elements[] = &$widget[$sub_key];
      }
    }

So the operations column is filled with 'submit' elements, which the Insert button is not.

Changing Line 238 breaks the insert function as it is now, and I do not know javascript so cannot explore that avenue further, and hence won't alter the status of this feature request.

The other workaround is to modify theme_file_widget_multiple. To do this correctly, you would copy the entire function to your themes template.php, and call it yourtheme_file_widget_multiple. You could then modify the if statement to be something like

if (isset($widget[$sub_key]['#type']) && ( $widget[$sub_key]['#type'] == 'submit' || $widget[$sub_key]['#theme'] == 'insert_widget')) {
Snater’s picture

Status: Active » Closed (won't fix)

Closing as won't fix. Apart from that there does not seem to be a table any more, while it would visually be nice to have all buttons in line, this approach would have other implications, i.e. It is good to have the Insert button right next to the style select box.