And I am working with some variables in hooknodesubmit which I trying to use to update the field value with. However, I am noticing that hooknodepresave seems to occur after hooknodesubmit. ![]() I've tried linking to the #submit part of the form, but in phpMyAdmin, all values are NULL.įor this code i haven't even changed the date, I'm just trying to get values to appear in the database. 'autocreate' > TRUE, ), ) newfield FieldConfig::create(newfield) newfield->original field newfield->enforceIsNew(FALSE) newfield->save() Updating entity view display configs In this section, the function locates all entity views display config items that are displaying the field being worked on, and updates them. I tried the hooknodepresave approach which seems promising. What I've ended up doing is creating two "dummy" date fields for DAY BEFORE and DAY AFTER, and I'm trying to hook into the form, grabbing the event date, using some PHP like strtotime() to add/subtract a day, and make these the values that would go into the database. Unfortunately, I can't use Rules Scheduler, because the Tokens can't be manipulated with PHP. 1 Answer Sorted by: 4 It is not recommended, there is a way of doing this using fieldattachupdate which should give you the performance benefit of not saving the whole node while using drupal api. Some actions will only show the full form after you save it. Check out the syntax of the API function below: fieldattachupdate(entitytype, entity) where entitytype can be node, user, comment, and entity should be entity with field. To avoid a confusion: it is CiviCRM Contact and its CiviCRM Custom Field. select one option from a list) value and send it via Drupal Rules by email. What I'm trying to achieve: get CiviCRM Custom Field (attached to CiviCRM Contact, and this is SELECT field type, e.g. It saves the field data value instead of the entire node, by doing so we can save a lot of time. Issue has been mentioned here for a several times, yet it looks there is no resolution so far. Fill each field and click on 'Save' button. fieldattachupdate saves the field data for an existing entity. Then select the appropriated Action type and click on the 'Continue' button. It seems that its impossible to update fields (from fieldsAPI) for fieldable entites with entitysave. To create a new action, access the 'Actions' tab at the Business Rules page and click on 'Add Action' button. (requires a full node load and save operation for each node!).I need to send out a reminder email the DAY BEFORE a Calendar Event as well as the DAY AFTER. When fields in node of content type A are updated, I need to update fields in the node of content type B automatically. Im gonna call this a support request, because I think I must be missing something. Then select the appropriated Event type and click on the 'Continue' button. ![]() I am using Drupal 7.44 and Field Collection 7.x-1.0-beta11. ![]() I try two solutions but the save function doesnt worked on both can you help 1. Sadly, there's no very simple way to do this (besides VBO/rules), but here's the code I use in update functions in my custom module install files when I need to prepopulate field values for a certain node type after adding a new field (in this case, 'page' nodes): fetchAllAssoc('nid') ĭb_insert('field_data_field_page_new_field')ĭb_insert('field_revision_field_page_new_field')Īnother manual method mentioned in this answer uses EntityFieldQuery and loads/saves each node. Access the 'Rules' tab at the Business Rules page and click on 'Add Rule' button. I need to update a collection field (unlimited) after the user save the node.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |