How do I alter certain module form output Some of my node types use fields from extra modules (such as Open Hours or Get Locations). How do I change the way those modules render their fields inside the form? I mean Get Location for example renders fieldset with fields in it. I'd like to change it at all. Also I'd like to change the order of fields and so on.
Is there anyway to make it using something like field--field-name.tpl.php for output fields?
Sorry if this is a common question but I couldn't find any complete guidance on this.
The form elements for fields (or "Field Widgets" as Drupal calls them) are defined using hook_field_widget_form(), e.g.

function hook_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $element += array(
    '#type' =&gt; $instance['widget']['type'],
    '#default_value' =&gt; isset($items[$delta]) ? $items[$delta] : '',
  );
  return array('value' =&gt; $element);
}


They use the form API, and don't have associated templates/themes unless one is explicitly set on a contained element.

You can use hook_field_widget_form_alter() to manipulate the elements; the simplest example (from the docs) would add a class to a particular element:

function hook_field_widget_form_alter(&amp;$element, &amp;$form_state, $context) {
  // Add a css class to widget form elements for all fields of type mytype.
  if ($context['field']['type'] == 'mytype') {
    // Be sure not to overwrite existing attributes.
    $element['#attributes']['class'][] = 'myclass';
  }
}


But obviously you're only limited by what the form API can do. So if you wanted to provide a specific theme for an element:

function MYMODULE_field_widget_form_alter(&amp;$element, &amp;$form_state, $context) {
  if ($context['field']['type'] == 'mytype') {
    $element['#theme'] = 'MYMODULE_some_theme';
  }
}


Then it would just be a matter of implementing hook_theme() and creating the template file to do what you need.

Just for posterity (and because I accidentally answered the question with this first time round); the following relates to formatting the output of a field when its parent entity is displayed:

As listed in Drupal 7 Template (Theme Hook) Suggestions, and originally defined in template_preprocess_field(), these are the built-in patterns you can use to override specific field templates:


field--field-name--content-type.tpl.php
field--content-type.tpl.php
field--field-name.tpl.php
field--field-type.tpl.php


You could also add your own using a template preprocess hook:

function MYTHEME_preprocess_field(&amp;$vars) {
  // This will let you use field--foo.tpl.php as the template name for any fields that pass the condition.
  if (some_condition()) {
    $vars['theme_hook_suggestions'][] = 'field__foo';
  }
}


As far as changing the order of field output goes, that's usually done through the UI in the "Manage Display" forms available for the various view modes for each entity type.