While form_set_error('field_firstname', t('message')); works fine, how can I do the same for one of several taxonomy fields? e.g. form_set_error('taxonomy[5]', t('message')); (which doesn't work). Can anyone help?
Found the answer. Here it is, for anyone who might have the same problem:
If the #parents property of your form element is array('foo', 'bar', 'baz') then you may set an error on 'foo' or 'foo][bar][baz'. Setting an error on 'foo' sets an error for every element where the #parents array starts with 'foo'.
So form_set_error('taxonomy][5', t('message')); works perfectly.
Related
I am experiencing some weird behaviour from WordPress when I use the get_categories function. When I use the below, it gives me a blank array.
get_categories(array('child_of' => 47, 'taxonomy'=>'category', 'hide_empty'=>0));
But if I remove the child_of, it works fine. If I replace child_of with parent, it also gives me a blank array.
What's even weirder is when I did a var_dump on get_categories, it gives me an array with no parent or category_parent (see the image below). I compared it against the wp_term_taxonomy and the table appears to be okay.
Screenshot comparing MySQL table and var_dump()
Any ideas on what might be causing this? Have I overlooked something? Many thanks in advance.
I am using JMS\Serializer in my project and I want to ignore one property only if the array in it is empty.
I tried something like :
#JMS\Exclude(if="count('$this->required') === 0")
or
#JMS\Exclude(if="empty('required')")
but got a syntax error.
Can anyone help me on this?
thank.
What you need was implemented recently and it is in release-1.7 so you might as well wait for it. It is called #SkipWhenEmpty
#SkipWhenEmpty This annotation can be defined on a property to
indicate that the property should not be serialized if the result will
be "empty".
This is the bug related it.
You need this one:
#JMS\Exclude(if="!object.required")
In selection-screen, I have one parameter called 'Author' I have called the report using 'Submit' from other report and passed the value to 'Author'. Now I need to make the 'Author' parameter as Read-only. How can I do that?
I used the following code,
LOOP AT SCREEN.
IF SCREEN-NAME = 'author'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
EXIT.
ENDIF.
ENDLOOP.
But it is not working. Can any one help me in resolving this?
Put your code in the at selection-screen output-event.
Disclaimer: This answer does not answer exactly your question, but perhaps it is an easier solution for your need.
If you need only a parameter for SUBMIT you may use
PARAMETERS AUTHOR NO-DISPLAY.
The parameter will not be visible on selection screen, but it can be used via SUBMIT.
This is not a 'read-only' it is a 'don't show' parameter.
I'm trying to create a view with a contextual filter on the title of the node and was wonder if there was a way to pass in a single letter as the argument and have the view return all node that begin with that letter?
Currently I've not found a way to do this, I have to pass in the full title of the node for it to work properly.
Thanks for any help.
To get this to work I had to provide a default value:
And then I also had set up the Glossary Mode:
I had set up the Glossary Mode before but it wasn't working the way I had expected. I guess the default value is required for it to work?
I used to use FeedSmith FeedBurner Plugin for my wordpress. Today, suddenly, my feeds are giving following errors under each Post Title. I recently upgrade to WP 3.0.1 but has been a week.
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home/name/wordpress/wp-includes/plugin.php on line 166
I deactivated the plugin and install new plugin "FD Feedburner Plugin" and try again but still no luck. The error still persist even on FeedBurner Page.
Any idea please?
Hopefully you have this fixed already. But I'd like to throw some thoughts on this since it remains unanswered. It appears that 50 people have come here since you posted 7 months ago so maybe I can help someone looking to resolve this or a similar problem. My answer is not specific to FeedBurner or even Wordpress.
The call_user_func_array function takes a string or an array as the first parameter and this parameter determines what function/method call will be made. In the case that the first parameter is an array then the method name should actually be the second element of the array and the first element should be the class name that contains the method.
For example:
call_user_func_array(array($class_name, $method_name), $params)
Because your error is saying that "'Array' was given" I can only assume that the first parameter passed to the function is either an empty array, the first parameter is an array with the first element being an empty array, or somewhere earlier in the code the class or function name was converted to a string as an array.
The same error message can result if the first function parameter is an empty array
Both of the following BAD examples will give the "'Array' was given" error:
call_user_func_array(array(), $params);
call_user_func_array(array(array(), 'method_name'), $params);
So if nothing else, you know that first parameter in the call_user_func_array function call is not what it needs to be.
Hope it helps!