Custom Attributes In Block designer
Permalink Browser Info Environment
Hi is it possible to add custom attributes to Block designer?
I have created one for page attributes but it would be great if i can use in within blocks that are created with block designer.
Thanks
Jack
I have created one for page attributes but it would be great if i can use in within blocks that are created with block designer.
Thanks
Jack
Type: | Pre-Sale |
---|---|
Status: | Resolved |
Hi
So what i mean is i have created an attribute that pulls in my font icon css. My users can then search for an icon by name or scroll through a list of icons. Check out the screenshots and i will attach my files.
I think you may have helped me to get this attribute to work in the first please.
I have looked at changing how the Font Awesome field type works and I am almost there I have got a select box of my icon names (css classes). Issue is that is after the block has been created and installed. Would be better to add it as a field type when you configure the block.
So what i mean is i have created an attribute that pulls in my font icon css. My users can then search for an icon by name or scroll through a list of icons. Check out the screenshots and i will attach my files.
I think you may have helped me to get this attribute to work in the first please.
I have looked at changing how the Font Awesome field type works and I am almost there I have got a select box of my icon names (css classes). Issue is that is after the block has been created and installed. Would be better to add it as a field type when you configure the block.
Hi Jack,
So you want to re-use this what you made and make that a field type within Block Designer like "Text", "Image", "Page" etc. are field types in Blocl Designer you want your own field type? Sorry if I misunderstood you here. Currently not on my desktop, so unable to install the Block Type you attached.
Kind regards,
Ramon
So you want to re-use this what you made and make that a field type within Block Designer like "Text", "Image", "Page" etc. are field types in Blocl Designer you want your own field type? Sorry if I misunderstood you here. Currently not on my desktop, so unable to install the Block Type you attached.
Kind regards,
Ramon
Yes that's right. I would like the attribute I created to be a field type within block designer. Like the "Text" field.
Thanks
Jack
Thanks
Jack
Hi Ramonleenders
Any ideas on this?
Thanks
Jack
Any ideas on this?
Thanks
Jack
Hi Jack,
I made a "How to" page here on the marketplace page for that:
https://www.concrete5.org/marketplace/addons/block-designer/create-y...
These are just the basics in there, for more advanced you can look in the source code of Block Designer, for example the "Text" field type or the "Stacks" field type (this last one is quite crazy, but you can probably see more advanced stuff here you'd need).
Does that help you? :)
Kind regards,
Ramon
I made a "How to" page here on the marketplace page for that:
https://www.concrete5.org/marketplace/addons/block-designer/create-y...
These are just the basics in there, for more advanced you can look in the source code of Block Designer, for example the "Text" field type or the "Stacks" field type (this last one is quite crazy, but you can probably see more advanced stuff here you'd need).
Does that help you? :)
Kind regards,
Ramon
Hi Ramonleenders
Thank you for this documentation. I have had a good read through and was wondering how it would work if im not using a package. I just use "/application/themes/s_theme" and "application/blocks"
Is it still possible to do?
Thanks
Jack
Thank you for this documentation. I have had a good read through and was wondering how it would work if im not using a package. I just use "/application/themes/s_theme" and "application/blocks"
Is it still possible to do?
Thanks
Jack
Hi Jack,
You do need a package to make this work. It can just be a controller.php though along with the needed files to make a field type for Block Designer. So it's not much you need! But that's also described. Eventually you can move your theme to the package, since it's adviced to make everything in a package, instead of loose things flying all over the place.
Kind regards,
Ramon
You do need a package to make this work. It can just be a controller.php though along with the needed files to make a field type for Block Designer. So it's not much you need! But that's also described. Eventually you can move your theme to the package, since it's adviced to make everything in a package, instead of loose things flying all over the place.
Kind regards,
Ramon
Okay great i see. Add my theme and blocks to a package is on my to do list.
Thanks, I will go give it a go.
Jack
Thanks, I will go give it a go.
Jack
Hi Ramonleenders
Finally got round to giving this ago. I have followed your steps exactly but my new field is nowhere to been seen within block designer. I have copied the font awesome field type for testing.
See my new package attached.
Any help would be great.
Thanks
Jack
Finally got round to giving this ago. I have followed your steps exactly but my new field is nowhere to been seen within block designer. I have copied the font awesome field type for testing.
See my new package attached.
Any help would be great.
Thanks
Jack
Hi Jack,
You almost had it. There wass a faulty namespace in this file:
packages/sapphire/BlockDesigner/FieldType/SapphireIconFieldType/SapphireIconFieldType.php
The first line should have this namespace:
namespace Concrete\Package\Sapphire\BlockDesigner\FieldType\SapphireIconFieldType;
So you forgot "Sapphire" in there. This since you currently are in the Sapphire package, so that's the namespace. Also defined here:
packages/sapphire/controller.php:54
That's the only needed change to make it work! Let me know if you got that working.
Kind regards,
Ramon
You almost had it. There wass a faulty namespace in this file:
packages/sapphire/BlockDesigner/FieldType/SapphireIconFieldType/SapphireIconFieldType.php
The first line should have this namespace:
namespace Concrete\Package\Sapphire\BlockDesigner\FieldType\SapphireIconFieldType;
So you forgot "Sapphire" in there. This since you currently are in the Sapphire package, so that's the namespace. Also defined here:
packages/sapphire/controller.php:54
That's the only needed change to make it work! Let me know if you got that working.
Kind regards,
Ramon
Thanks for check over my code.
I change the namespace and reinstalled the package on my site but i still can't see the field type within block designer.
Did you install my package when testing it?
Thanks
Jack
I change the namespace and reinstalled the package on my site but i still can't see the field type within block designer.
Did you install my package when testing it?
Thanks
Jack
Thanks for check over my code.
I change the namespace and reinstalled the package on my site but i still can't see the field type within block designer.
Did you install my package when testing it?
Thanks
Jack
I change the namespace and reinstalled the package on my site but i still can't see the field type within block designer.
Did you install my package when testing it?
Thanks
Jack
Hi Jack,
Yes, I tested it. Literally the only change is this:
<?php namespace Concrete\Package\Sapphire\BlockDesigner\FieldType\SapphireIconFieldType;
See the attached screenshot. Did you make the change, save the file and check the Block Designer page?
/index.php/dashboard/blocks/block_designer
Kind regards,
Ramon
Yes, I tested it. Literally the only change is this:
<?php namespace Concrete\Package\Sapphire\BlockDesigner\FieldType\SapphireIconFieldType;
See the attached screenshot. Did you make the change, save the file and check the Block Designer page?
/index.php/dashboard/blocks/block_designer
Kind regards,
Ramon
Got It working now.
I wasn't on the latest version of Block Designer.
I wasn't on the latest version of Block Designer.
With "Custom Attributes", you mean attributes you can attach to a page like "Exclude from Navigation" (which is a checkbox)? Or what do you mean? Perhaps you can explain with pictures too, will give me a lot more insight!
Kind regards,
Ramon