publicForm & Css
Hi,
i got a pretty urgent problem: I need to modify the css class for form fields in a public form, but i can't get around on how to modify the args for any of the hooks (around line 21) in /pods/ui/input-fields.php
// from pods core:
// pre-field hooks
do_action('pods_pre_input_field', $field, $css_id, $css_classes, $value, &$this);
do_action("pods_pre_input_field_$name", $field, $css_id, $css_classes, $value, &$this);
do_action("pods_pre_input_field_type_$coltype", $field, $css_id, $css_classes, $value, &$this);
I tried everything that i could imagine and google or the other known channels (wp answers, wp hackers) didn't return any info.
// this works and outputs test right after every form field
function test_me() {
echo 'test';
}
add_action ( 'pods_pre_input_field', 'test_me', 11 );
// this **doesn't** work
function test_me_now() {
return $css_classes = 'test-class';
}
add_action ( 'pods_pre_input_field', 'test_me_now', 11 );
Help is much appreciated. Thanks in advance!
Ps.: The pre html tags work in the preview, but not if you post...
edited Mar 16 '11 at 6:56
2 Answers
These action hooks are not actually designed to modify the css class of an input field, but rather to trigger an action or display some HTML before an input field. There currently isn't a filter hook to directly modify the css classes. You can either add input helpers to the fields and modify the $css_classes variable inside the helpers, or or could try declaring $css_classes as a global variable inside your 'pods_pre_input_field' hook:
<?php
function test_me_now() {
global $css_classes;
// do something with the $css_classes variable;
}
add_action('pods_pre_input_field','test_me_now');
?>
Thanks for your answer. I talked to scott about how css might change with 2.0 and came to the solution, that i simply add some filters for myself to core (site won't reveive any further update).


