Comments

melon’s picture

Status: Active » Needs review
StatusFileSize
new887 bytes
melon’s picture

Title: Allow empty ad sizes in size » Allow empty ad sizes in responsive settings
ndewhurst’s picture

I tested the patch, and it worked as expected.
It seems that we might want to make it more explicit, for better admin UX. The second patch keeps the validation in place, but revises it so that users can enter "<none>" in the Ad Size(s) field for any breakpoint at which the slot should be suppressed. It also revises various error messages and descriptive text to explain this new option.
I've been testing this, and so far it appears to be working nicely. I'd love it if someone else could verify and RTBC it.

Status: Needs review » Needs work

The last submitted patch, 3: dfp-suppress_ad_slots_per_breakpoint-2383919-3.patch, failed testing.

ndewhurst’s picture

I'll need to update the tests to take the new option into account...

ndewhurst’s picture

Here's a new patch with an updated test (I didn't create a new test to verify that the "<none>" keyword is allowed and results in the expected javascript - I just updated an existing test to look for the new validation error message in its assertion).

ndewhurst’s picture

Status: Needs work » Needs review
kbasarab’s picture

Testing against #6

Functionally it works and the ads appear as expected. I would suggest adding some documentation to the field descriptions so it is obvious what is happening. Like This browser viewport and under will show the following ad position.

Also in UX the add another breakpoint functionality seems to not be functioning and causing some chaos in the text fields:
http://note.io/1FlJcXe

Looks like it is adding a second ad size text field and there is no delineation between where one breakpoint starts and another one begins. See screenshot above.

robloach’s picture

Status: Needs review » Reviewed & tested by the community

Worked against the latest DFP release.

Also in UX the add another breakpoint functionality seems to not be functioning and causing some chaos in the text fields:
http://note.io/1FlJcXe

Is there some additional module/styling applied to your settings? This change does not functionaly change the UI of the breakpoints, just the validation and processing.

chriskinch’s picture

I have also tested the patch in #6 and it works great.
I am not getting any issues with the "Add another breakpoint" UI button either.

Would be great to get this committed. :)

joestewart’s picture

Unclear why, but we had some ads not appearing with the preg_replace in this patch. Changed:

-      $ad_sizes = preg_replace('/.*<none>.*/', '', $breakpoint['ad_sizes']);
+      $ad_sizes = strpos($breakpoint['ad_sizes'], '<none>') ? '' : $breakpoint['ad_sizes'];

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 11: dfp-suppress_ad_slots_per_breakpoint-2383919-11.patch, failed testing.

joestewart’s picture

Didn't mean to change status from RTBC. Patch should apply this time.

rolfmeijer’s picture

As a workaround I added a breakpoint with 1x1 which was not added to the size(s) field.

F.i. my sizes field has:
160x600,120x600

And my breakpoints are:
768x0 — 160x600,120x600
0x0 — 1x1

Only screens wider than or equal to 768px get the ad, smaller ones don’t.

mrconnerton’s picture

$ad_sizes = strpos($breakpoint['ad_sizes'], '<none>') ? '' : $breakpoint['ad_sizes'];

should be

$ad_sizes = strpos($breakpoint['ad_sizes'], '<none>') !== FALSE ? '' : $breakpoint['ad_sizes'];

since strpos is going to return 0.

dpolant’s picture

Rolling mrconnerton's fix into a patch.

luke adams’s picture

I just came across this post, applied *-13.patch (manually) and have tested against the 7.x-1.5 codebase with multiple ad slots on my site.

Working as expected.

Is this intended on being rolled into the stable codebase sometime?

Thanks!

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new3.71 KB

Re-rolled patch

marcelovani’s picture

StatusFileSize
new3.71 KB

Re-rolled again

cllamas’s picture

Tested in 7.x-1.x branch and it's working as expected.

cllamas’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 19: dfp-suppress_ad_slots_per_breakpoint-2383919-19.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new3.76 KB

Re-rolled patch

ssawyersj’s picture

New here, so sorry if this is a dumb question: is there any equivalent issue for this update on the Drupal 8 version of the DFP module? Or would this change also apply to the D8 code?

willhowlett’s picture

Status: Needs review » Reviewed & tested by the community

Tested most recent patch against latest 7.x-1.x version and works as expected

dzepol’s picture

Tested patch from #23 against the dev and applies correctly. No errors and works as expected.

marcelovani’s picture

StatusFileSize
new4.34 KB

Just one little improvement to the tests

--- a/tests/dfp_display_tag.test
+++ b/tests/dfp_display_tag.test
@@ -69,6 +69,13 @@ class dfpDisplayTagTest extends dfpBaseTest {
     $edit['breakpoints[0][ad_sizes]'] = $this->randomName(8);
     $this->editTag($tag->machinename, $edit);
     $this->assertText(t('The ad size(s) string can only contain numbers, the character x and commas (unless it is the special keyword "!none").', array('!none' => htmlspecialchars('<none>'))), 'An error was correctly thrown when the Ad Size(s) field contained an invalid pattern.');
+
+    // Test tags with ad_size set to <none>.
+    $edit['breakpoints[0][browser_size]'] = '0x0';
+    $edit['breakpoints[0][ad_sizes]'] = '<none>';
+    $this->editTag($tag->machinename, $edit);
+    $this->drupalGet('');
+    $this->assertRaw('addSize([0, 0], [])');
   }

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: allow_empty_ad_sizes_in-2383919-27.patch, failed testing. View results

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new4.02 KB
Osmar Manjo’s picture

I can confirm that #29 works for me

  • marcelovani committed aafd9b2 on 7.x-1.x authored by ndewhurst
    Issue #2383919 by marcelovani, ndewhurst, joestewart, melon, dpolant,...
marcelovani’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

nikolay shapovalov’s picture

StatusFileSize
new2.89 KB

I don't want to use dev version but want this patch.
I create patch from #29 and just remove changes to test file, so patch can now be applied to 1.5 version.