0

i noticed there exists a template_preprocess_field function on the Drupal website, but i added in my template.php files just this...

function mytheme_preprocess_field(&$variables, $hook) {
   kpr($variables);
}

my question is, is the drupal function running too? in the system somewhere as well as my preprocess function?,

they seem to both be running. any insight would be helpful, thanks

1

Yes definitely it will go to parent function too because this is concept of overriding. But final impact would be of your override function.

Say example:

// Parent Function: First go to this fucntion

function template_preprocess_field(&$variables, $hook) {
   print "Parent Function";
   $variables['test_variable'] = "Parent data";
   ....
}

// Child Function: Override values using child function

function mytheme_preprocess_field(&$variables, $hook) {
   print "Child Function";
   $variables['test_variable'] = "Child data"; // Override value here
   ....
}

Now this $test_variable contains "Child data" value not "Parent data" because it is overrided.

I hope it would help you to understand basic concept of overriding.

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.