There seem to be two issues here:

1) When a default slug is set, it is displayed for a tag, even if you set the tag's slug to <none>
2) Confusion over whether or not to use <none> in the default slug. It should not be used. Using <none> in the default slug field will display the text <none>.

Comments

elephant.jim’s picture

There are a couple of things going on.

For starters, I was misunderstanding the module configuration instructions when I said that <none> would show up. For the default slug, if you want no slug, you should leave the field blank. OTOH, for a particular slot, <none> is necessary for an empty slug. Perhaps the instructions for the default slug can be amended to read, "Slug all ad tags with this label. Leave blank for no slug."

But then there's a related bug. dfp_format_slug() gets called twice for ads in blocks: once by dfp_tag() and once by template_preprocess_dfp_tag(). S'pose my default slug is "Advertisement", but the ad slot says to have none. When dfp_tag() runs, the slug is set to the empty string. However, then template_preprocess_dfp_tag() sees the empty string and sets the slug to the default slug.

Should dfp_format_slug() be called by dfp_tag()?

jesse.d’s picture

Status: Active » Needs review
StatusFileSize
new436 bytes

I just ran into this same issue. I guess it's still around. As mentioned in #1, dfp_format_slug is called twice. Once in dfp_tag and once in template_preprocess_dfp_tag(). The attached patch removes the call to dfp_format_slug() in dfp_tag, allowing the template preprocess to handle the display of the slug. This fixes the problem that I was having of not having an effect on an ad slug if there is a default ad slug set.

Status: Needs review » Needs work

The last submitted patch, 2: dfp-none-displays-default-slug-2248211-2.patch, failed testing.

jesse.d’s picture

Issue summary: View changes

Updating issue summary

Rossh’s picture

I'm attempting to solve the issues with the above patch which has now expired. The solution works for me at a local level, but I'd like a formal patch for it here for further projects

tariqinam’s picture

StatusFileSize
new559 bytes
tariqinam’s picture

StatusFileSize
new559 bytes
tariqinam’s picture

+++ b/dfp.module
@@ -963,7 +963,6 @@ function template_preprocess_dfp_tag(&$variables) {
-  $tag->slug = dfp_format_slug($tag->slug);

Removing the dfp_format_slug() from template_preprocessor as it tries to reset already generated slug in dfp_tag(). which ultimately causing this issue.

tariqinam’s picture

Status: Needs work » Needs review
guardiola86’s picture

Status: Needs review » Reviewed & tested by the community

I've just tested the last patch and it works well.

  • VladimirAus committed 7dbabc71 on 7.x-1.x authored by tariqinam
    Issue #2248211 by tariqinam, jesse.d, Rossh, guardiola86, elephant.jim,...
vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for contribution. 🍻
Committed!

vladimiraus’s picture

  • VladimirAus committed 7dbabc71 on 7.x-2.x authored by tariqinam
    Issue #2248211 by tariqinam, jesse.d, Rossh, guardiola86, elephant.jim,...

Status: Fixed » Closed (fixed)

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