By qinqiu on
Hi friends
who can tell me
function your_module_element_info() {
return array(
'new_form_type' => array(
'#input' => TRUE,
'#tree' => TRUE,
'#process' => array('_new_form_type_process'),
'#value_callback' => '_new_form_type_value_callback',
));
}
function
_new_form_type_value_callback($element, $input = FALSE, &$form_state) {
if ($input !== FALSE) {
// Process $input
} elseif (!empty($element['#default_value'])) {
return $element['#default_value'];
}
return;
}
the real meaning of
'new_form_type'
'#input' => TRUE,
'#tree' => TRUE,
'#process' => array('_new_form_type_process'),
'#value_callback' => '_new_form_type_value_callback',
Could some one tell me meaning of
$element,
$input = FALSE,
&$form_state
Thanks.
Comments
_
that looks to be a sample implementation of hook_element_info. For more info see: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_element_info/7.
ok but question...
I v no intention to be a help vampire, and sure will pay it forward - later.
The situation is, the link you recommend to me to read is the link i come from before I posted the help thread. Very complicated sentense, but less than API paragraphs. For the each word on API is understandable literally, but not contextually.
Please help me.
Code of the function:
Does this code mean that it will return $types, and input will be filtered. but no definition it will be fitered by Filter HTML format, or PHP format? how to filter ? why no definition of type ?
Also, on the hook_element_info API page, the return value explaination is,
We can not find $types from above code quotation. So....?
Also, we see #*** is not return value, but so called "property"?
i want to search propery and data in this site. but no body say about it.
First sentence of hook_element_info API page is:
But i can not see the type from the above code. So where am i wrong ?
By the way,some time we see $var, $variables, $account,$user.
Could you please tell me where it come from? or something else.
I am sorry to say that my question seems no-place-found but i am not an ET, just not clever.
so, smart and clever IT genius like you can help us a little.
Could you please think one second and Solve my problem.
a piece of cake to you, right? I will thank you for years.
I read books like Using Drupal, definitive guide for drupal, some videos, but SEEMS that all with no explaination of what i need to know -- some details explaination. Maybe english is your native language, word is clear but i also learn english for many years, and can talk about business with english people freely. why can not i understand HERE ??
Thanks!
exampl
i only read part of the books.
here is a question:
i see
but where is
I can not understand the meaning.
Thanks.
Does this code mean that it
The return value, $types in this case, is exactly what it says it is in the api link i provided above which you quote.
The fact that the example uses a variable name of '$types' is of no consequence-- you can name it $bananas as long as it matches what is being expected.
Depends on the context-- but assuming you mean in the function definition, those are the functions arguments. Again, what they're called is usually descriptive of what the function is expecting, but it doesn't have to be. And they would come from the function call which passes them on to the function.
There's also more info at the link on the api page: http://drupal.org/node/169815 (it's for d6, but it should still be pretty much the same).
These are questions about the drupal form api-- generally considered a somewhat difficult topic as far as drupal programming goes. There more documentation in the handbook, but honestly I found the book "pro drupal development" to be the best way for me to learn.
Your attitude makes wanting to do that very difficult. We are all volunteers here and we don't have to do anything, much less solve your problem. Recognizing and appreciating that instead of making snide comments will be much more likely to get your post some replies.
And I do get that english is not your first language-- which is why I'm cutting you some slack. I can't even imagine trying to learn these concepts, already difficult in a native language, in a foreign language. Give yourself a break-- this is difficult to begin with. Kudos for trying!
Maybe it might be useful if you tried to find a book or website in your native language-- or even a local drupal users group (see groups.drupal.org).
thanks a lot
my comment is not snide. a small compliment. I do think that drupal gurus like you are smart and clever. really. actually, everyone is smart and clever, if not sleeping all day, or at least in some aspects one is clever and smart. I checked your profile and found that you worked in BIG GIANT companies. Great.
language is a not a problem, i learn english for years. How many years you guess.17 years.
concepts are not difficult once it s clearly and detailed stated, perfect if stated from a-z from origin to end usage.
hook_element_info will return array, no matter what name, but it should be a type, am i right?
You said very well. name is just a symbol, it is ok to be descriptive or not.
Now the point is:
strings,variables content, function callback, function invoke... in *.module under mdule-name folder
1, the matching --> where it will match or be applied in some place
2, the origin --> it is arbitrary or rules must be obeyed.
Also,now the problem is:
my computer is very slow,esp memory. So i plan to use another computer to var_dump variables i am not sure, and use search function to find where the string will be reused or appear in some place.
I will also download the book pro drupal development.
thank you for help. Volunteers will deserve. Once i am familiar with drupal, i can develop modules, help new comers...
thanks.