I have some wildcard URL's in the Page Specific Visibility Settings within my block. When I create the block as a field in Display Suite, it just shows on every single page instead of the ones I only want i to appear on.

Comments

shashi_lo’s picture

Priority: Major » Normal
nevets’s picture

I would not expect (or want) Display Suite to honer block visibility settings when I display a block using DS.

xtfer’s picture

Category: bug » feature

Im going to mark this as a feature request, as I'm not sure its necessarily the best default behaviour to split visibility control between the block interface and ds. Context and Panels don't work this way, for example.

That doesn't mean we can't find a way to address it, but it probably wont be the default behaviour.

swentel’s picture

Yeah, i'm tempted to mark this won't fix as well - I've marked this won't fix for a D7 issue as well since it really doesn't make sense in my opinion.

xtfer’s picture

Status: Active » Closed (won't fix)

For consistency then, marking this won't fix.

andreic’s picture

I've recently ran into a similar issue where I had to have the right side blocks when using Display Suite but also take into consideration the block visibility. So, I came up with the following php code (for Drupal 7) to display my blocks. Please note I also had to create a region called "Right sidebar blocks" for my case. I included the code in a code block field in DS and it was ready to go. From there, just head to the blocks region and move the desired blocks to "Right sidebar blocks" region.
If you have suggestions on improving the solution, please share them.

# get the current url page
$args = preg_split('/\//', $_SERVER['REQUEST_URI']);
array_shift($args);

$current_page = arg(count($args)-1);
$parent_page = arg(count($args)-2);
   
$result = db_query("SELECT * FROM {block} where theme = 'chnhiv' and region = 'basic_page_blocks' order by weight");

foreach ($result as $row) {  
  if ($row->visibility == 0 and $row->pages != '') { # if visibility "All pages except those listed" is set and page paths are inserted one per line, display the block
    if (stristr($row->pages, $current_page) === FALSE) {
      $block = module_invoke($row->module, 'block_view', $row->delta);
      print '<div class="block" style="margin-bottom:25px;"><div class="content">'.render($block).'</div></div>';
    }  
  } elseif ($row->visibility == 1 and $row->pages != '') { # if visibility "Only the listed pages" is set and page paths are inserted one per line   
    if (stristr($row->pages, $current_page)) { # if the current page was not found in the block visibility, display the block
      $block = module_invoke($row->module, 'block_view', $row->delta);
      print '<div class="block" style="margin-bottom:25px;"><div class="content">'.render($block).'</div></div>';
    }
  } elseif ($row->visibility == 0 and $row->pages == '') { # if visibility "All pages except those listed" is set and no page path is given   
      $block = module_invoke($row->module, 'block_view', $row->delta);
      print '<div class="block" style="margin-bottom:25px;"><div class="content">'.render($block).'</div></div>';
  }

}
bousley’s picture

Version: 6.x-2.x-dev » 7.x-2.6
Issue summary: View changes

Duplicate. Remove.

bousley’s picture

Priority: Normal » Major
Status: Closed (won't fix) » Needs work

I'm using Display Suite and wanted to use this feature on a custom layout, but what good does it do me if it's going to display on every single page of a given content type? I only want the block to appear on certain content pages -- not every single node of a specific content type. Kind of defeats the purpose of calling it a block... This is a great module, but I have a complex layout -- for a financial service institution -- and they only want blocks to appear on certain pages but not on others. Help please!

nevets’s picture

You should really start your own issue and not piggyback on an existing issue.

bousley’s picture

The "existing issue" was closed, nevets. You could contribute something to the discussion, rather than making smart arse remarks, bud.

swentel’s picture

Status: Needs work » Closed (duplicate)

#1936128: Block field Doesn't respect block visibility settings is where work happens, which can be backported if wanted.