Drupal 8 Twig Template - Show menu if node has a menu item - menu

I am creating custom twig templates for a Drupal 8 theme. I want to render a menu in a region only if the node has a menu link (i.e. when editing the node the menu settings on the right has been configured so the “provide a menu link” box has been checked).
Ideally I would like to create this in the twig template so I can change the layout accordingly, but any pointers greatly appreciated!

Usually this issue is handled differently(by creating a separate content type and set visibility) but for the sake of the question I'll give some solutions.
Solution 1: Block Visibility Groups.
If that is not enough.
Solution 2: hook_block_view_alter(or any other hook_ENTITY_TYPE_view_alter) where you can deactivate the access to menu block after you check if condition is met with Drupal::routeMatch() to check what node is displayed.

Related

Need help in 2017 R2 - 17.200.0401 modern UI Sitemap

I have created some new categories and added my screen under that category, do we have an option to put these newly created categories and sitemap structure into customization project or else we need to recreate manually in each instance.
Group 1 and Group 2 are the new categories I have created and linked some screen under it.
The steps are:
Add the page to the classic SiteMap (SM200520)
Add classic sitemap entry to your customization project sitemap section and publish it
Add your page to modern UI
In customization project editor SiteMap section click 'Reload from Database'
The Reload from Database step should add the Modern UI sitemap entry.
You can check if the modern UI were packaged in the customization project items (Menu->File->Edit Items). Project items of type SiteMapNode that deploy to modern UI will have XML elements/attributes prefixed with 'MUI' (ModernUI).
if we uncheck entry screen checkbox for GI screens, we are able to get the entry form in both Title Menu and as well as in Menu Item also. But, as these default Acumatica GI screens are in Hidden folder, they are not exposing in Add Menu Item popup, so I moved to Help folder
A combination of John's answer and HB_ACUMATICA's answer seems to be the more complete answer. The steps in HB_ACUMATICA's answer works, except if the classic Sitemap item is contained in certain folders (in my case, Finance/AR/Configuration/Manage), then it won't show up on the modern UI in the list of items to choose. If I moved it to the Help folder, then I could choose it. Anyone know what the criteria is for including an item in the modern UI item choice list?

Orchard custom forms override Create.cshtml for one content type only

I have created a custom content type ContactForm and I'm using the Custom Forms module.
Is there a way to override the Create.cshtml file only for the ContactForm?
I tried Create-ContactForm.cshtml but it's not working.
If you want alternate view to be displayed follow the steps.
1. Enable Designer tools module.
2. View the page where create.cshtml is displayed.
3. You will see see small minus sign in right bottom corner, click it to enable shape tracing.
4. Trace the shape for which you want alternate view.
5. check shapes tab, there will be multiple alternate options availbale. click on create for appropriate one.
6. find and edit that template in visual studio.
first of all read about alternates and shape tracing.
some reference for you.
http://devhammer.net/blog/Customize-Orchard-CMS-with-Designer-Tools
http://docs.orchardproject.net/Documentation/Alternates

Concrete5 core blog thumbnail, How can I reuse it on other composers

Concrete5 comes with package blog_entry by default.
This package includes image thumbnail with width and height restriction.
How can I reuse it with other types?
So I want to build a different Blog and use these thumbnails.
Thanks
To make a page type available to the Composer dashboard interface, go to Dashboard -> Pages & Themes -> Page Types, and click the "Composer" button next to the appropriate page type (then check the appropriate boxes depending on how you want this set up).
If you want to make some content fields available for data entry also, click the "Defaults" button next to the page type (in the "Page Types" dashboard page), then add a block to an area on your page, then click on the block and choose "Composer", and check the box to make it available in the composer interface.
The "thumbnail image" for the blog posts are utilizing an "image" block in the page defaults, so after you've enabled your page type to work with composer, go to the page defaults and add an "Image" block to an area, then I think you can edit that block and set some default dimensions. Before you exit edit mode, click on the image block and choose "Composer" and check the box to make it available to the composer interface. Now it should appear when you write new pages of the new page type in Composer.
You'll want to create a custom template for the Page List block (then place the page list block on your blog "index" page, then click on the block in edit mode and choose "Custom Template" from the popup menu and pick your custom template from the list there).
Here are general instructions on how to create custom templates:
http://www.concrete5.org/community/forums/usage/how-to-make-a-custom-template/
http://www.concrete5.org/documentation/how-tos/designers/custom-block-templates-views/
http://concrete5studio.com/support/tutorials/creating-a-custom-template/
Note that as of Concrete 5.5, the markup in the Page List default template is much cleaner and easier to work with than what's shown in the above link. But if you're still on 5.4 or lower, I have cleaner versions of some block templates available here (this is actually what the newer version of the system template is derived from):
https://github.com/jordanlev/c5_clean_block_templates
See the comments of those templates for instructions on including an image thumbnail specifically.

create menu from taxonomy/term in drupal 7

in the documentation site of drupal:
http://drupal.org/node/774892
It shows an example of how to create a menu using taxonomies. Basically we must add a link to an url like taxonomy/term/{termID}/all . But it says it can not work with drupal 7. is there any other way to make that menu from a hierarchical taxonomy?
Thank you
Yes there is a module Taxonomu menu. You can generate menu for any vocabylary.
Transform any of your taxonomy vocabularies into existing menus
easily!
P.S. I use 7.x-1.x-dev release instead of recommended. There are more options
You can use Taxonomy menu module for the same.

How to add subpages in Orchard CMS

I added a new page in the main menu, e.g. Products. Now I want to add a subpage e.g. Sub Products below a Products page. I tried all possible options in the dashboard but it didn't work for me. Any ideas how to handle this?
Thanks.
here is a quick solution for this
Go to your dash board -->Gallery -->Modules
search for Hierarchical menu and install it
after installing then go to Configuration -->Features and enable it.
Go go to Navigation .give position like 2 for "Products" and 2.1 for "Sub products".
you will see Sub products appear under Products page.
As of Orchard CMS 1.5 this is supported by the core navigation module. Now you can simply drag and drop menu items under one another in the Admin -> Navigation view. You can then control level rendering under the widget settings for the menu by setting the "Start level" and "Levels to display" properties.
See release notes for further details.
The navigation documentation doesn't seem to be up to date though :(
Take a look at: http://orchard.codeplex.com/Thread/View.aspx?ThreadId=242327
The module to support this (along with many other modules) is available in Orchard's module gallery.

Resources