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

Type: Pre-Sale
Status: Resolved
JackVanson
View Replies:
ramonleenders replied on at Permalink Reply
ramonleenders
Hi Jack,

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
JackVanson replied on at Permalink Reply 3 Attachments
JackVanson
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.
ramonleenders replied on at Permalink Reply
ramonleenders
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
JackVanson replied on at Permalink Reply
JackVanson
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
JackVanson replied on at Permalink Reply
JackVanson
Hi Ramonleenders

Any ideas on this?

Thanks

Jack
ramonleenders replied on at Permalink Reply
ramonleenders
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
JackVanson replied on at Permalink Reply
JackVanson
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
ramonleenders replied on at Permalink Reply
ramonleenders
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
JackVanson replied on at Permalink Reply
JackVanson
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
JackVanson replied on at Permalink Reply 1 Attachment
JackVanson
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
ramonleenders replied on at Permalink Reply
ramonleenders
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
JackVanson replied on at Permalink Reply
JackVanson
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
JackVanson replied on at Permalink Reply
JackVanson
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
ramonleenders replied on at Permalink Reply 1 Attachment
ramonleenders
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
JackVanson replied on at Permalink Reply
JackVanson
Got It working now.

I wasn't on the latest version of Block Designer.

concrete5 Environment Information

n/a

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.