[support] problem with theming the form
Radek
mtrener at gmail.com
Mon Sep 24 09:49:17 UTC 2012
the code below doesn't seem to work. I've copied it from DGD7 book for
learning purposes. I placed it in template.php in my custom theme
directory, but nothing changes to the contact-site-form. I'm working on
Linux (Ubuntu). I don't understand what's wrong either with the code or
approach.
<?php
/**
* Implements hook_theme().
*/
function dgd7_theme() {
return array(
'contact_site_form' => array(
'render element' => 'form',
),
);
}
/**
* Implements theme_forms_contact_site_form().
*/
function dgd7_contact_site_form($variables) {
// Hide the subject field. It's not required.
hide($variables['form']['subject']);
// Change the labels of the "name" and "mail" textfields.
$variables['form']['name']['#title'] = t('Name');
$variables['form']['mail']['#title'] = t('E-mail');
// Create output any way you want.
$output = '<div class="something">';
$output .= '<p class="note">'. t("We'd love hear from you. Expect to
hear back from us in 1-2 business days.") .'</p>';
$output .= render($variables['form']['name']);
$output .= render($variables['form']['mail']);
$output .= '</div>';
// Be sure to include a rendered version of the remaining form items.
$output .= drupal_render_children($variables['form']);
// Return the output.
return $output;
}
Mark_owsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120924/51c79e3c/attachment.html
More information about the support
mailing list