Comments

jgadrow’s picture

Assigned: codycraven » jgadrow

Picking this up now.

jgadrow’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB

Please see the attached patch for this.

jgadrow’s picture

Status: Needs review » Needs work

The previous patch has failed testing as it caused failures for other entity types. Upon further investigation, there are deeper logic errors that are affecting this. Setting to needs work while we work on resolving.

jgadrow’s picture

Status: Needs work » Needs review
StatusFileSize
new40.39 KB

I have made sweeping changes to the gpt and gpt_entity modules to correct this behavior (also a few tweaks I made while working through it since they corrected errors I encountered along the way). Here's a list of the changes:

1) The targetting forms were genericized and abstracted. This is the bulk of the patch diff.
2) I added '#limit_validation_errors' => array(), to all ajax calls to eliminate the need to input all of a form's required elements just to add additional keys or values for targeting or breakpoints for ads.
3) I changed the low-level forms (ad_slot_form and gpt_settings_form) so that they no longer have a _submit function which didn't really "do" anything. It is now required to call gpt_{$form_id}_prepare_values() to retrieve values for one of these embedded forms.
4) I removed a number of functions that were no longer useful or necessary:
a) gpt_ad_slot_form_targeting_ajax_callback()
b) gpt_ad_slot_form_targeting_key_add()
c) gpt_ad_slot_form_targeting_value_add()
d) gpt_ads_form()
e) gpt_entity_form_alter()
f) gpt_entity_form_submit()
g) gpt_settings_form_targeting_ajax_callback()
h) gpt_settings_form_targeting_key_add()
i) gpt_settings_form_targeting_value_add()
5) I removed all "hack" changes that I found within the source which stemmed from our misunderstanding of the use of subform.
6) I changed $form_state['global_settings'] to $form_state['has_override'] as it works better with the newer context of the abstracted targeting form.
7) I manually-inserted the #id values for the various override fields as they preventing the visible states to be used if the form was wrapped in other elements.
8) I altered the logic for processing gpt_settings_form non-targeting values so that they could be set properly with only a single if/else logic.
9) I have modified the ancillary targeting functions (validation, adding keys/values, etc.) behave properly when the targeting values are nested in a location other than $form_state['values']['targeting_wrapper'].
10) I made an alteration to default value settings that eliminated some notices and warnings regarding unset indexes under certain conditions.
11) gpt_entity no longer use form submit handlers to do its processing of entities. Instead it uses hook_field_attach_submit(), hook_field_attach_insert(), and hook_field_attach_update().
12) subform is now only utilized for the ad manager settings form additions.

jgadrow’s picture

StatusFileSize
new66.29 KB

I have re-rolled this patch to correct an issue that was discovered with multiple entities built using the same form (field_collection entities in this case). This new patch should meet the previous change list as well as these new requirements:

1) If multiple entities would attach to the same form, a single GPT form should be added which will apply to *all* entities for that form.
2) Upon submission, we are now checking to ensure that entity data is only being saved after we have passed validation and that the entity being submitted also has been allowed for specifying GPT settings.

Note: This patch, if applied together with the entity settings patch for Issue #2030635, will cause a conflict and require manual resolution due to them both being concerned with when the settings form should be displayed.

Additional Note: This patch changes the parameters for this function which requires a minor rewrite for the static cache patch as the form is no longer used to determine entity type and entity.

phpisuber01’s picture

StatusFileSize
new143.56 KB

Code reviewed and verfied working. Updated the changes to remove tabs in exchange for spaces.

phpisuber01’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new64.61 KB

Ignore the post above, attached was a bad patch file.

Below is the patch file for gpt.admin.inc to fix the tabs.

codycraven’s picture

Status: Reviewed & tested by the community » Needs work

Patch will not apply to latest 7.x-1.x and the patch also contains whitespace and dpm() calls.

vjgalatro’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new480 bytes

I was able to fix this by ensuring the 'subform_submit_all' submit handler is attached to the form.

codycraven’s picture

Status: Needs review » Reviewed & tested by the community

  • vjgalatro authored d8b0fa9 on 7.x-2.x
    Issue #2001694 by vjgalatro: Entity targeting does not save for terms
    
codycraven’s picture

Status: Reviewed & tested by the community » Fixed
krisahil’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Assigned: jgadrow » krisahil
Priority: Normal » Critical
Status: Fixed » Needs review
StatusFileSize
new3.8 KB

The patch in #9 fixes taxonomy term forms, but actually breaks node addition forms. The attached patch applies the change from #9 conditionally, so subform_submit_all() gets called only if necessary.

Also fixed how subform files were included by fixing #subform_file properties.

krisahil’s picture

StatusFileSize
new4.2 KB

See updated patch.

  • codycraven committed c8e5ae8 on 7.x-2.x authored by krisahil
    Issue #2001694 by krisahil: Entity targeting does not save for terms
    
codycraven’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.