Still very much a newbie...

When looking at a layout configuration, under Contexts it allows you to Add Context. If you choose "of Type Term", it then asks for the "ID of the Taxonomy Term".  Where do I find that (without doing a search of the database) as I don't see it any where and Taxonomy Terms simply lists the Terms created.

Most helpful answers

Hi Ian, if you look for the ID of a specific term, go to the page which lists the terms of a vocabulary, e.g. admin/structure/taxonomy/tags, look for the term in question, and hit its "Edit" link. You will find the URL including the term ID in the address bar of your browser.

In the following example the term ID is 4:

https://example.org/taxonomy/term/4/edit?destination=admin/structure/taxonomy/tags

Hi Ian, and thanks for the question. This sounds like you are not completely familiar with how Layouts work (it's a complex topic! search for other Layout questions in the forum, or watch the videos StPaulTim has created.)

Contexts are like "add ons". So, you can add a node or a term as context to any layout - that will make that particular node or term available to all the blocks of that Layout.

Let's say you want to add a term context to your layout. But how does the site know WHICH node or term you want to add to the layout? There are basically two ways:

- You can use a placeholder in the layout path, and tell Backdrop to use that as the term id. For example, your path could be: my-path/%. The Layout UI will then allow you to choose the type of context to add based on that placeholder. You can choose a term, a node, a user, etc. So, if you visit "/my-path/4" then the Layout will automatically load the term with ID 4, which will be available to the blocks.

- OR you can "hard code" the term ID. For example, if your layout path is /my-path  you can manually add a term context. In that case the UI will ask you to specify the Term ID (which is hard-coded, and will always be the same for that particular Layout).

 

I hope this helps! Keep in mind that it is possible to have more than one placeholder in the layout path, e.g., my-path/%/%, and choose a different entity (node, term, user) for each of those placeholders.

 

Comments

Hi Ian, and thanks for the question. This sounds like you are not completely familiar with how Layouts work (it's a complex topic! search for other Layout questions in the forum, or watch the videos StPaulTim has created.)

Contexts are like "add ons". So, you can add a node or a term as context to any layout - that will make that particular node or term available to all the blocks of that Layout.

Let's say you want to add a term context to your layout. But how does the site know WHICH node or term you want to add to the layout? There are basically two ways:

- You can use a placeholder in the layout path, and tell Backdrop to use that as the term id. For example, your path could be: my-path/%. The Layout UI will then allow you to choose the type of context to add based on that placeholder. You can choose a term, a node, a user, etc. So, if you visit "/my-path/4" then the Layout will automatically load the term with ID 4, which will be available to the blocks.

- OR you can "hard code" the term ID. For example, if your layout path is /my-path  you can manually add a term context. In that case the UI will ask you to specify the Term ID (which is hard-coded, and will always be the same for that particular Layout).

 

I hope this helps! Keep in mind that it is possible to have more than one placeholder in the layout path, e.g., my-path/%/%, and choose a different entity (node, term, user) for each of those placeholders.

 

You are correct in that I am struggling with layouts and how they work, particularly in how to assign a layout to a specific page or type of page, and how to change the layout associated with a particular page or type of page after another layout has been associated with it.

What I am attempting to do is get the page ManufacturerHistories to use the layout Manufacturer Histories (which shows up as manufacturer-histories in the browser when edited) but it seemed to default to the layout "Nodes with Images" which had the path set to mysite/node/%, automatically set a context to "Position 2: node/%" of type Node, and the visibility condition "content type is Page, Story". Since the page I'm working on (MH above) has no images and is of type Story, I removed "Story" from the visibility condition and this is when the page MH changed to using the default layout.

My settings for layout MH (m-h) are path mysite/node/%, auto context "Position 2: node/%" of type Node, and visibility condition "URL path" - Paths "ManufacturerHistories". I had assumed this was what was required to get he MH (m-h) layout to display whenever I visit mysite/ManufacturerHistories, but it still uses the default layout.

I have searched for pages and videos via Google but nothing much is returned and it seems there is a dearth of information for the newbie out there. I have watched almost all of StPaulTim's videos during the course of my attempt to move my existing site from D7 to BD and have found them very helpful - and the forums here have also helped.

My question re contexts came about from my attempt to see what happened if I used a context of type Term to get the MH (m-h) layout to check for the Term "manufacturer" which is one of only 3 terms I've set up so far - "about", item", and "manufacturer".

I will review your reply a few times (to let it all sink in)...

 

Olafski's picture

Hi Ian, if you look for the ID of a specific term, go to the page which lists the terms of a vocabulary, e.g. admin/structure/taxonomy/tags, look for the term in question, and hit its "Edit" link. You will find the URL including the term ID in the address bar of your browser.

In the following example the term ID is 4:

https://example.org/taxonomy/term/4/edit?destination=admin/structure/taxonomy/tags

Thanks Olafski - I can now see the term Id for my term is "3".

I wonder why mysite/admin/structure/taxonomy/tags shows only the name of the terms and has no display for the term ID... would seem to be a useful thing if an admin is required to use the ID rather than the term itself in Contexts.   :D

Now - remember how I opened my initial question? "Still very much a newbie..." - well despite having over 25 years experience in designing/coding websites (and I've been using Typo3, Drupal and Wordpress since 2002/2003) I have just discovered I made a BASIC mistake with the layout I was working on...

Imagine my embarrassment, after getting the layout to work on a new duplicate test site and comparing the setups, when I discover my whole problem was the result of a rogue blank space in my visibility condition!! I had "[space]ManufacturerHistories" as the condition instead of "ManufacturerHistories" and that is why it didn't work. <embarrassed blush>

However the whole exercise, and this post, has not been without benefit thanks to your replies above, which have at least taught me something new!

Thanks Folks!

 

Glad you got it sorted @ian. Don't worry, even the most experienced of us have face palm errors that have us scratching our heads for hours trying to fix.