I've added a menu block & slide-show block as fields in a DS layout but it's not hiding them based on the path, I'm guessing that part of the problem is the fact that the Block is now part of a field?
For example:
Going to this path http://www.mysite.com/welcome/1
Should show the normal node content but with slide-show block and menu block type 1
Going to this path http://www.mysite.com/welcome/2
Should show the normal node content but with slide-show block and menu block type 2
And so on
Is there any way around this? Or does DS not have the ability to perform these tasks?
Comments
Comment #1
Tony Finlay commentedComment #2
swentel commentedIt is indeed not listening to those settings - but that could be a feature request though. However, such visibility settings could work on any sort of field, not a block only. I'm already thinking about some sort of conditional system for DS, see #1235902: Create conditionals in fields. - maybe this is a second use case in fact.
Comment #3
Tony Finlay commentedThanks for getting back to me on this, I'm about to enter into a live project and was testing this out first.
I think this would be a fantastic implementation as I use DS on pretty much all my projects now, it has the right balance of lightweight simplicity and great functionality built in.
I hope this isn't being too brazen but would you know of another module I could use in conjunction with DS to offer this functionality at the current time? I've tried context but it only recognises core regions and Views is completely overkill for the kind of site that is being built.
P.S. Do I have to open another issue as a feature request or will you just recognise this one as a request?
Thanks again
Comment #4
swentel commentedThere is no other module right now that does this afaik. I've marked this one duplicate of the one I mentioned #2. I can't promise a timeframe with DrupalCon coming up. Will be something for early september I think.
Comment #5
Tony Finlay commentedI think I've found a solution using mini panels. By putting the content you want into a mini-panel and then setting it's visibility to listen for a particular argument from a string gets you a result, but only when using raw paths; "node/1/argument" when it comes to aliased paths it unfortunately takes the argument as the path and serves up a "page not found" error. But all is not lost as I found a module called "sub path auto" which allows aliased paths to take several depths of arguments... And voila... problem solved, all you have to do now is import the exposed mini-panel into DS as a block field.
If anyone would like a step by step let me know.
Comment #6
matthewv789 commentedNot having this feature forces creating lots of redundant content types just to include different blocks on different pages, even if the layout and input fields for each of those pages are identical.
EDIT: I now realize that creating custom View Modes (especially with View Mode per Page enabled) can take care of this use case, and may even be a more elegant solution.
Comment #7
knalstaaf commentedI've been doing some research on the web (1, 2, 3) and the handbook but I can't really figure how to achieve this feature through custom View Modes (as described in #6).
I also tried to call in the Context module for this, but with no luck (DS blocks and DS regions aren't displayed in the Context reactions).
Comment #8
Tony Finlay commented@knalstaaf
See post #5, this is the only way I've found that it works. As someone said it's a lot of extra effort to make this work, hopefully it will be a core feature of DS soon.
Comment #9
knalstaaf commentedI've enabled Mini Panels (for the very first time ever), but I'm getting lost in the configuration...
Basicly I want a certain DS block only to appear on the homepage.
Comment #10
Tony Finlay commentedOk you have to create a mini-panel first from: admin > structure > mini-panels
Along the top of the mini panel creation screen you'll see the following 4 options:
Settings » Context » Layout » Content
1: First name your panel under the settings page, for example: "Context Mini-Panel". then click 'Layout' from the top menu and select: Columns: 1 from the select box on that page.
2: Next click 'Content' from the the options above
3: On this page you should see a title bar (set this to whatever you want) and below that a grey box with a little cog in the top left corner, click the cog.
4: A context menu appears, choose the top option 'Add content'
5: A window appears with a menu on the left, in that menu choose 'Custom Blocks'.
6: Choose the block you want and then click finish.
7: You'll be taken back to the main screen but your block will now occupy the grey space.
8: On your block you'll see a cog in the right corner, click it and choose 'Add new rule' under the visibility rules section within the context menu.
9: In the pop up window choose String: URL path
10: On the next page you have to options, choose 'Allow access on the following pages'
11: In the paths box enter and click save
12: Then click save again on the main screen.
13: Now go into this location yoursite.com/admin/structure/ds/fields
14: From the options at the top of this window choose 'Add a block field'
15: On the next screen enter a label
16: On the same screen under Entities choose - 'Node'
17: On the same screen again choose from the block select list the name of your mini panel and click save.
Now all you have to do is go to the manage display screen of the homepage and activate the block there, it will only appear on that page.
You can add multiple blocks to that mini-panel and have them appear/hide on different pages.
Comment #11
matthewv789 commentedI find Panels to be hopelessly confusing also, so have never ended up using it.
If you are just using Display suite, here's what to do:
(In case you don't know already how to include blocks using Display Suite, on Content Types > Manage Display, at the bottom click the "Add Custom Fields" tab, then click "Add a Block Field" button and select an existing block. Now it will show up along with the other fields that can be assigned to various DS regions for display.)
Comment #12
knalstaaf commentedThanks Tony & Matthew for the great help!
#10 demands a little effort but is the most flexible I think. In my case solution #11 works ok, because it's a rather limited site (so far).
There's a project in the pipeline that's going to be more complex though, #10 will be more advised I believe (since the homepage won't be a node on itself for instance).
Again: thanks for the elaborate explanation. I've saved the page so I can easily consult it for the coming projects.
Comment #13
Tony Finlay commentedNo probem, I have implemented my solution in a production website which has yet to go live. I've used it along with the sub-path auto module and it has allowed me to offer different blocks based on a query strings.
For example there is a landing page with three options, by clicking on any one of them sends you to that specific section of the site. This sounds like it could be done without the above steps but the problem is that the three sections of the site share certain pages which would've normally meant duplicate nodes with the same information which would've meant the client had to update three times as much info.
By using the mini panels methoed I was able to show active paths for good UX and offer relevent slideshows and other section specific blocks, with all of it centered around a single node.
I'll post a link once I have the site live so you can see for yourself as I know I'm not the most articulate when it comes to explaining these things.
Comment #14
mepperly commentedMatthew,
Thank you so much for the steps in #11.
My google-fu had utterly failed me. Everyone wanted to tell me how to layout the view information with DS when what I wanted was to not have to make a new content type every time I wanted to add a view to one or two pages of a content type.
Bless you.
Meg