אני עכשיו עושה הכרות עם המודול המדהים computed field, אבל כדרכם של הכרויות ראשונות -ההתחלה קשה.
יש שני איזורים בהם אפשר להכניס קוד : computed code ו display format.
ב computed code נכנס הקוד שעושה את החישוב . בסוף החישוב צריך להציב את הערך המוחזר במשתנה ['node_field[0]['value$.
ב display format צריך להציב במשתנה display$ מחרוזת שתוצג בשדה זה.
ציטוט מהתאור של display format :
This code should assign a string to the $display variable, which will be printed as the value of the field. The stored value of the field is in $node_field_item['value']. Note: this code has no effect if you use the "Computed Value" formatter option. Alternately, this code can be supplied by your own custom function named computed_field_field_total_voyage_length_display().<
הבעיה שלי:
גם אם אני כותב ב computed code את הקוד הבא:
$test = 'hello';
$node_field[0]['value'] =$test;
וב display format את הקוד:
$display =$node_field_item['value'];
הוא לא מציג לי את השדה.
אשמח לרעיונות.