[support] problem with theming the form
Tomasz Kisielewski
tom.kisielewski at gmail.com
Mon Sep 24 10:06:02 UTC 2012
Hi Radek
Did change name in theme function to 'yourtheme' name it will be
function yourthemename_theme().....
and later
function yourthemename_contact_site_form($variables) {....
I only had problems with hide($variables['form']['subject']); drupal
reported it as mandatory.
And ALWAYS clear chache ( even twice ). It doesn't matter Linux or Windows
as far as http server is set up corectly
On Mon, Sep 24, 2012 at 10:49 AM, Radek <mtrener at gmail.com> wrote:
> 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
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120924/7fcbf614/attachment-0001.html
More information about the support
mailing list