I’m putting together a website. I’ve got two CMS collections - one called ‘Sectors’ and one called ‘Work’. In the ‘Sectors’ collection, I specify the name of the sector and the colours I would like the relevant project to use in the title/background. Then in the ‘Work’ CMS list, I add a multi-reference field and choose a relevant sector to the project. It all works well..
Now I would like to style the title of the project based on the sector it is linked to. However, it looks like the dynamic styling only works within the given CMS collection list - it doesn’t go ‘deeper’ and doesn’t allow to get colours from the multi-reference field.
Is it something people have come across? I thought I wouldn’t have to add colour fields 30 times (number of projects) but only 4 (number of sectors). Did anyone else come across this query?
If you had a collection list bound to your multi-reference field, and listed the Sectors for the current Work, then you can get that color within that collection list.
There isn’t a way to directly get and bind a single color ( e.g. the first item in the multi-ref ) from outside of that Sectors-field-bound collection list, in part because there are 0 or more possibilities to choose from.
If there’s some reason you really need to use that color elsewhere you could emit your Sectors using a field-bound collection list, and then get it using custom code.
Thanks a lot for the response. Please see the read-only link in which I tried to quickly get the look of the page to work: Webflow - Ian Chalk Architects
In there, you can see I assigned the colours to each Sector, and then used multireference field in Work collection to choose an appropriate Sector for each project. Now, I would like to get the colours from the Sector and assign them for each project.
In the dynamic styling, I only get the colours from the ‘Sector’ collection - it doesn’t look like I can choose it for the parent (aka project from ‘Work’ collection).
memetican, I believe I do have those collections bound but it would be good to understand, based on the read-only link, if I’m missing a trick somehow! Any thoughts or help would be appreciated:)
You have set this up as a multi-ref field, even though you’re storing exactly 1 item in each. Redesign that as a single-ref field and make it required. That way you have one sector for each work, and a logical way to associate that color.
Webflow can expose that to you easily then for binding.
You could call that Primary Sector.
I’m guessing that you chose a multi-ref because there are other situations where you might want multiple sectors, e.g. for navigation between sectors and works. In that case, you can also keep this existing Project Sectors field, but you have to admin both so that your Primary Sector is also always listed in your Project Sectors list.
Exactly that - it is set up as multi-ref as some of the projects may fall under two sectors. But that’s a good point regardless you made, I think it’s better to create a ‘Primary Sector’ and bind it to the projects and then have ‘All Sectors’ displayed as tags of some sort. That way, I could get colour just from the Primary! Let me try that - and thank you for the suggestion, much appreciated!