1

I want to alter CCK field in theme layer so I use Theme Developer to find candidate function for this:

template.php:

function omega_starterkit_email_formatter_contact($element) {
    firep($element, 'element');
    return $element;
}

firep gives me this output:

Array
(
    [#formatter] => contact
    [#node] => stdClass Object
        (
            [nid] => 15
            [type] => opiekun
            [language] => 
            [uid] => 0
            [status] => 1
            [created] => 1306400895
            [changed] => 1307955137
            [comment] => 0
            [promote] => 0
            [moderate] => 0
            [sticky] => 0
            [tnid] => 0
            [translate] => 0
            [vid] => 15
            [revision_uid] => 1
            [title] => Magna Volutpat
            [body] => 
            [teaser] => 
            [log] => 
            [revision_timestamp] => 1307955137
            [format] => 0
            [name] => 
            [picture] => 
            [data] => 
            [path] => opiekun/magna-volutpat
            [field_phone] => Array
                (
                    [0] => Array
                        (
                            [value] => vKaqmxdNJZAALXErcWBi2qkKcZZneTVXNjmye6LBoe6zccGDFj
                            [safe] => vKaqmxdNJZAALXErcWBi2qkKcZZneTVXNjmye6LBoe6zccGDFj
                        )

                )

            [field_email] => Array
                (
                    [0] => Array
                        (
                            [email] => email
                            [safe] => email
                        )

                )

            [taxonomy] => Array
                (
                )

            [referencing_node] => stdClass Object
                (
                    [nid] => 385
                    [type] => page
                    [language] => pl
                    [uid] => 0
                    [status] => 1
                    [created] => 1307101436
                    [changed] => 1307362258
                    [comment] => 0
                    [promote] => 0
                    [moderate] => 0
                    [sticky] => 0
                    [tnid] => 0
                    [translate] => 0
                    [vid] => 385
                    [revision_uid] => 1
                    [title] => Maszyny
                    [body] => 
                    [teaser] => 
                    [log] => 
                    [revision_timestamp] => 1307362258
                    [format] => 1
                    [name] => 
                    [picture] => 
                    [data] => 
                    [path] => maszyny
                    [field_opiekun] => Array
                        (
                            [0] => Array
                                (
                                    [nid] => 15
                                    [safe] => Array
                                        (
                                            [nid] => 15
                                            [title] => Magna Volutpat
                                            [status] => 1
                                        )

                                )

                        )

                    [field_photos] => Array
                        (
                            [0] => 
                        )

                    [taxonomy] => Array
                        (
                        )

                    [files] => Array
                        (
                        )

                    [build_mode] => 0
                    [readmore] => 
                    [content] => Array
                        (
                            [field_opiekun] => Array
                                (
                                    [#type_name] => page
                                    [#context] => full
                                    [#field_name] => field_opiekun
                                    [#post_render] => Array
                                        (
                                            [0] => content_field_wrapper_post_render
                                        )

                                    [#weight] => -4
                                    [field] => Array
                                        (
                                            [#description] => 
                                            [items] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [#formatter] => full
                                                            [#node] => stdClass Object
 *RECURSION*

Before this function I display link to e-mail contact form page.

All I want to do with this link is change label from 'Email Contact Form' to something different.

  • Which function is firep()? – kiamlaluno Jun 13 '11 at 10:50
  • This is debug from Drupal for Firebug module – Codium Jun 13 '11 at 19:52
4

There are generally two ways of controlling the output of a field.

  1. Create a field formatter in a module which you can then activate for the field of the type it's made for.
  2. Overwrite the theming function that the field formatter uses to render the output.

It seems like you are trying to do #2, but what you have posted doesn't look like a theming function. Are you sure you have named it correctly, have you cleared cache? If you name your theme function correctly and clear the theme cache, it will always take precedence, if done in your site's theme.

0

Content Template or Custom Formatters

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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