Closed (fixed)
Project:
Google Publisher Tags
Version:
7.x-2.x-dev
Component:
Entity targeting
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
23 May 2013 at 13:35 UTC
Updated:
28 Sep 2015 at 21:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jgadrow commentedPicking this up now.
Comment #2
jgadrow commentedPlease see the attached patch for this.
Comment #3
jgadrow commentedThe 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.
Comment #4
jgadrow commentedI 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.
Comment #5
jgadrow commentedI 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.
Comment #6
phpisuber01 commentedCode reviewed and verfied working.
Updated the changes to remove tabs in exchange for spaces.Comment #7
phpisuber01 commentedIgnore the post above, attached was a bad patch file.
Below is the patch file for gpt.admin.inc to fix the tabs.
Comment #8
codycraven commentedPatch will not apply to latest 7.x-1.x and the patch also contains whitespace and dpm() calls.
Comment #9
vjgalatro commentedI was able to fix this by ensuring the 'subform_submit_all' submit handler is attached to the form.
Comment #10
codycraven commentedComment #12
codycraven commentedComment #13
krisahil commentedThe 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.
Comment #14
krisahil commentedSee updated patch.
Comment #16
codycraven commented