Multi Page and Multi File Attribute types
Permalink
Hi concrete5 peeps,
In the last week or so I've put some finishing touches on a couple of new attribute types and have published these to github (MIT).
These are two attribute types I've been meaning to build for a while, as there were similar ones in 5.6 that were very handy.
The two attributes types are of the same style, in that they allow you to select multiple pages, and select multiple files/images.
The multiple page selector is here:
https://github.com/Mesuva/multi_page_selector_attribute...
And the multiple file picker is here:
https://github.com/Mesuva/multi_file_selector_attribute...
Where these attributes can come in handy is when you crafting page types to store data in structured ways, and want to make such pages completely composer driven.
For the multiple page selector for example, you might want to have something like a blog post, but select a couple of related blog posts.
With this attribute you have a sitemap to check pages against (with filtering to a page type if you like). Then on your page template, you fetch the attribute and loop through the pages to create links.
Or it might be something where you've got a page type for a 'product', and you want to link to related products. Our it could be a 'case study', where you link to the services or products you've used in the solution. It's a one-to-many mapper of pages really.
The multiple file attribute is perhaps much more useful to me though. Numerous times I've wanted to create a composer driven page type where you can pick 'n' number of files, to create a slideshow, gallery or similar. Often this has meant adding a large (but limited) number of file/image attributes, ones that can't be re-ordered. Often the best option has been to simply add a gallery block directly to the page, meaning it's not as easy to manage as a composer form alone.
So this attribute allows you to have a single attribute to select as many files as needed. The attribute can be filtered to a type of file (so images, documents, videos, etc), as well as configured to have a maximum number of files. It also supports the checkbox selection of files in the file manager (where you pick 'choose' from the drop down to select them), meaning that you can add files in bulk, from a set for example, to save a lot of clicking.
I've attached a couple of screenshots to show what they look like.
MrKDilkington has kindly tested these out and helped fixed bugs, but I'm open to further feedback. I think they're ready to go, but I still want to road test these a bit.
Although they're more something to be in a developer's toolkit (since you need to be able to work with the output programatically), I may put these on the marketplace once I'm happy they are stable.
Hope these are useful!
-Ryan
In the last week or so I've put some finishing touches on a couple of new attribute types and have published these to github (MIT).
These are two attribute types I've been meaning to build for a while, as there were similar ones in 5.6 that were very handy.
The two attributes types are of the same style, in that they allow you to select multiple pages, and select multiple files/images.
The multiple page selector is here:
https://github.com/Mesuva/multi_page_selector_attribute...
And the multiple file picker is here:
https://github.com/Mesuva/multi_file_selector_attribute...
Where these attributes can come in handy is when you crafting page types to store data in structured ways, and want to make such pages completely composer driven.
For the multiple page selector for example, you might want to have something like a blog post, but select a couple of related blog posts.
With this attribute you have a sitemap to check pages against (with filtering to a page type if you like). Then on your page template, you fetch the attribute and loop through the pages to create links.
Or it might be something where you've got a page type for a 'product', and you want to link to related products. Our it could be a 'case study', where you link to the services or products you've used in the solution. It's a one-to-many mapper of pages really.
The multiple file attribute is perhaps much more useful to me though. Numerous times I've wanted to create a composer driven page type where you can pick 'n' number of files, to create a slideshow, gallery or similar. Often this has meant adding a large (but limited) number of file/image attributes, ones that can't be re-ordered. Often the best option has been to simply add a gallery block directly to the page, meaning it's not as easy to manage as a composer form alone.
So this attribute allows you to have a single attribute to select as many files as needed. The attribute can be filtered to a type of file (so images, documents, videos, etc), as well as configured to have a maximum number of files. It also supports the checkbox selection of files in the file manager (where you pick 'choose' from the drop down to select them), meaning that you can add files in bulk, from a set for example, to save a lot of clicking.
I've attached a couple of screenshots to show what they look like.
MrKDilkington has kindly tested these out and helped fixed bugs, but I'm open to further feedback. I think they're ready to go, but I still want to road test these a bit.
Although they're more something to be in a developer's toolkit (since you need to be able to work with the output programatically), I may put these on the marketplace once I'm happy they are stable.
Hope these are useful!
-Ryan
General purpose attribute types have always been a bit awkward in the marketplace.
- If they are in a marketplace package of their own, it introduces a dependency from any packages that may use them
- If developers add them under MIT to their own packages, there is a risk of variations diverging and colliding.
- If we get a mixture of both the above .......
Perhaps the best solution would be to get these included in the core. That way, we have one standard implementation without introducing marketplace dependencies.