Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a block #266

Open
davidnicholls125 opened this issue Jan 13, 2025 · 4 comments
Open

Adding a block #266

davidnicholls125 opened this issue Jan 13, 2025 · 4 comments

Comments

@davidnicholls125
Copy link
Collaborator

We want to add the Donate Strip custom block to the 'How to Identify' page. I've added the page (I think) to 'Limit Field' settings but can't then find it on the ID page. I've used the node to identify the page rather than the URL alias (maybe both work?) as shown below. Is this correct?
The guidance notes I put together from your previous help may also have become outdated. Could you let me know if anything has changed and what I need to do to add the block? (https://www.naturespot.org/admin/blocks)
image

@johnvanbreda
Copy link
Owner

Sorry, this is a bit more complex than it should be! The way you are doing it is to use the Display Suite module's ability to create custom block fields which can be added to a page on the "Manage Display" tab, as long as the limit field box is set correctly so the block field is made available to that type of page. The limit field box format is based on "bundle" (this is the page type, e.g. page, article, event etc) and the view mode (which is normally just set to default, but can be things like teaser if you are showing the page content as part of a list). So you can't actually limit the donate strip block so that it will appear only for the how to identify page, you have to expose it for all basic pages like this:

species|*
page|*

It won't magically appear on all the pages, you still have to use "Manage Display" to add it. That would work on Alan's How to Identify news item (https://www.naturespot.org/node/258225) but it won't work on your main identification help page (https://www.naturespot.org/content/identification) because I have turned on a feature called "Layout Builder" on the latter page, in order to allow me to position the latest species image block at the bottom. This is a newer way of laying things out which is a lot more flexible. So, in this case, you would need to click the Layout tab and add it via there (Google Drupal Layout Builder if you want to find some tutorials). For now I've done this for you.

@davidnicholls125
Copy link
Collaborator Author

Thanks John. I did ask in an email a few days ago how to hide the title 'Identify Help' on this page (as we have a banner instead). I've looked at the block in layout and the title box is unticked so how do I prevent is displaying?

@johnvanbreda
Copy link
Owner

There is a module for doing this (https://www.drupal.org/project/exclude_node_title) but if there are likely to be only one or two pages with hidden titles then it might be best if I just write some custom code. Do you think there will be more than a handful of similar cases?

@davidnicholls125
Copy link
Collaborator Author

Probably not so custom code sounds a good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants