Timeline for Override Field.tpl.php for a specific node/add form
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 13, 2012 at 18:08 | vote | accept | big_smile | ||
Apr 28, 2012 at 9:26 | comment | added | Oswald |
Please copy error messages literally, they are good search phrases to enter into a search engine. I think you get a "Parse error: syntax error, unexpected T_DOUBLE_ARROW". This comes from string( 'FIELD_NAME ' => array(/**/)) . This is not a construct that PHP understands. Use drupal_render() to render a render array into a string.
|
|
Apr 27, 2012 at 19:09 | comment | added | big_smile | To: Oswalrd it returns a double arrow error. To: sheena_D: Shouldn't these changes be done in the theme (because different themes might use different field.tpl.php files)? | |
Apr 18, 2012 at 8:56 | comment | added | sheena_d | You should be implementing the hook_form_alter() function, not creating a theme function. You cannot use a template to alter form items, you need to make the changes in PHP. | |
Apr 16, 2012 at 8:30 | comment | added | Oswald | What's a double error? | |
Apr 14, 2012 at 10:37 | comment | added | big_smile |
Thanks! This is the code I am using: function MYTHEME_theme($existing, $type, $theme, $path) { return string( 'FIELD_NAME ' => array( 'arguments' => array('form' => NULL), 'template' => 'templates/add/from', 'render element' => 'form', ), ); } . However, it returns an error saying that I have a double error. Thanks for any help you can offer.
|
|
Apr 13, 2012 at 18:27 | comment | added | Oswald | You return an array. The theme function should return a string. | |
Apr 13, 2012 at 10:23 | comment | added | big_smile |
Thanks! After reading the docs on hook_form_alter(), I think it should be this: function chapel_theme($existing, $type, $theme, $path) { return array( 'FIELD_NAME ' => array( 'arguments' => array('form' => NULL), 'template' => 'templates/add/from', 'render element' => 'form', ), ); } but it doesn't work. Do you know what I am doing wrong?
|
|
Apr 12, 2012 at 14:12 | history | answered | Oswald | CC BY-SA 3.0 |