Cómo "themear" sólo un campo del formulario

Sin duda hay muchas formas pero para casos extremos este método sugerido por la gente de Lullabot es muy bueno.

function custom_theme_registry_alter(&$theme_registry) {
  if (!empty($theme_registry['form_element'])) {
    $theme_registry['form_element']['function'] = 'custom_form_element';
  }
}

function custom_form_element($element, $value) {
// aquí un ejemplo de cómo hacer algún cambio para un campo en particular en base al #id
  if($element['#id'] == 'edit-calendar-goto-datepicker-popup-0'){
      //$element['#description'] = 'aquí pongo mi texto de ayuda';
    }
    

  // Here, we provide our customized version of the
  // theme_form_element function from theme.inc...
  
  // This is also used in the installer, pre-database setup.
  $t = get_t();

  $output = '
*' : ''; if (!empty($element['#title'])) { $title = $element['#title']; if (!empty($element['#id'])) { $output .= ' \n"; } else { $output .= ' \n"; } } $output .= " $value\n"; if (!empty($element['#description'])) { $output .= '
'. $element['#description'] ."
\n"; } $output .= "
\n"; return $output; }

Ver

http://www.lullabot.com/articles/overriding-theme-functions-in-modules

Etiquetas: