Timeline for Create node programmatically with menu entries
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:41 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Apr 11, 2016 at 17:27 | vote | accept | Meito | ||
Mar 30, 2016 at 17:42 | comment | added | Stefanos Petrakis | The field field_tag is a multivalue field, the delta gives you access to each value, in your case each term. Happy ending! N.B.: You should accept the answer if it solved the problem. | |
Mar 30, 2016 at 17:15 | comment | added | Meito | It works and problem solved :-) Thank you very much. I understand most of the snippet except for the delta part. It is not clear to me what delta stands for. | |
Mar 30, 2016 at 15:23 | comment | added | Stefanos Petrakis | Add P.S.2 with a little snippet showing how to do this. Let me know how this goes. | |
Mar 30, 2016 at 15:22 | history | edited | Stefanos Petrakis | CC BY-SA 3.0 |
added 389 characters in body
|
Mar 30, 2016 at 14:56 | comment | added | Meito | I am using the token_replace/string, because I do not know how to get the terms through the field_tags field. I tried $terms = $node->field_tags[LANGUAGE_NONE][0]['tid'], but that is probably the wrong way | |
Mar 30, 2016 at 12:30 | comment | added | Stefanos Petrakis | That means that the token_replace/string manipulation part could be causing the problem. If you get a nid, you could also, as an alternative, load the node and then its terms through the field_tags field. This would be more reliable codewise, you will have a direct access to the node's values, instead of hiding things inside token replacements and exploding strings. :-) | |
Mar 30, 2016 at 12:26 | comment | added | Meito | The plid numbers exist. When I am changing $terms to something simpel like $terms = array('Taxonomy_Term1','Taxonomy_Term2','Taxonomy_Term3'), it works just fine. | |
Mar 30, 2016 at 11:28 | comment | added | Stefanos Petrakis | Then the next possible problem is the plid numbers you use, 5,6,7 should be existing menu items ids in your main-menu. Can you check this? | |
Mar 30, 2016 at 11:14 | comment | added | Meito | I edited my post with the proper use of $node->menu, but the problem still occurs. | |
Mar 29, 2016 at 19:06 | history | answered | Stefanos Petrakis | CC BY-SA 3.0 |