enter image description here

After uploading an image, how do I hook in and change the display so that Title appears above Alternate text?

  • any specific reason for you to display the title tag above and alt tag below Feb 19, 2015 at 18:47
  • I am using this to create and sort images for a Galleria slideshow, which uses Title for the Title and Alternate text for the Description.
    – carsonw
    Feb 19, 2015 at 19:47
  • You want to change image in that field
    – Ram
    Feb 20, 2015 at 5:51

1 Answer 1


Here's the answer, which I discovered after some further research:

 * Implements hook_field_widget_form_alter().
function MYMODULE_field_widget_form_alter(&$element, &$form_state, $context) {
  // If this is an an image on a slideshow
  if (isset($context['form']['type']['#value']) && $context['form']['type']['#value'] == 'slideshow') {
    // Loop through the element children (there will always be at least one).
    foreach (element_children($element) as $key => $child) {
      // Add the new process function to the element
      $element[$key]['#process'][] = '_MYMODULE_image_field_widget_process';

function _MYMODULE_image_field_widget_process($element, &$form_state, $form) {
  // Change the way metadata form fields are displayed;
  $element['title']['#weight'] = '-4';
  $element['alt']['#title'] = 'Description';
  // Return the altered element
  return $element;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.