Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Right now the first thing I do when using PHP code is this
echo str_replace(' ', ' ', nl2br(htmlentities(print_r($data, TRUE))));
Any chance you could place the output of this into a collapsed fieldset on the field edit form?
Comment | File | Size | Author |
---|---|---|---|
#4 | views_customfield-732158.patch | 3.76 KB | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedHow about having this code on the view form as a code box ready to paste in?
Comment #2
intyms CreditAttribution: intyms commentedto put a collapsibe fieldset on the "Customfield" form, we have to add the following code to "views_customfield_handler_field_phpcode.inc" :
place the code inside "function options_form(&$form, &$form_state)"
between $form['value'] and $form['sortable'].
The problem is that i don't know how to add the variables stored inside $data to the '#description' field from above.
Can anybody with php skils help to finish the implementation of this feature ?
Comment #3
Slovak CreditAttribution: Slovak commentedSubscribe
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedHere's a patch based off of #2. Makes the code ready to paste in.
Comment #5
intyms CreditAttribution: intyms commentedI have observed just one thing, there are many "+" and "-" signs inside of the patch.
Everything else is great, patch forks very well !!! Thanks a lot!
Comment #6
intyms CreditAttribution: intyms commentedComment #7
mikeytown2 CreditAttribution: mikeytown2 commentedthe + and - is my editor fixing white space issues automatically.
http://drupal.org/project/coder
http://drupal.org/coding-standards#indenting
If this is an issue I can manually roll out a new patch with the whitespace fixes removed.
Comment #8
intyms CreditAttribution: intyms commentedoh, i see, sorry.
I tested the patch, it works great for me.
Comment #9
mikeytown2 CreditAttribution: mikeytown2 commentedComment #10
iantresman CreditAttribution: iantresman commentedIs it possible to convert the output into "PHP Variable code"? For example, the patch outputs something like this:
But I'm not sure how to output either the value, or label, when using PHP. I have eventually worked out (and it took some time, and will take time when I try again in several weeks), that
To output the value of
[node_data_field_quantity_field_price_value]
I must enter:<?php echo $data->node_data_field_quantity_field_price_value; ?>
which is not intuitive! And can you output anything else?