A way to GET view templates available under a block ?
Permalink
Is there a function already existing in concrete to get the list of block view TEMPLATES available under a block. ?
I would like to add a selectbox that would list block view templates at the same time of entering the data.
I find that sometime the extra step of selecting another view template is overkill when they need to add many of the same block.
Thanks
I would like to add a selectbox that would list block view templates at the same time of entering the data.
I find that sometime the extra step of selecting another view template is overkill when they need to add many of the same block.
Thanks
Many thanks,
I'll go check it out.
Cheers,
I'll go check it out.
Cheers,
Hi,
try this
For more details visit
http://www.concrete5.org/documentation/developers/blocks/block-type...
try this
$bt = BlockType::getByID($b->getBlockTypeID()); $templates = $bt->getBlockTypeCustomTemplates(); print_r($templates);
For more details visit
http://www.concrete5.org/documentation/developers/blocks/block-type...
Thanks all,
I think I might have a problem since I'm trying to get the block custom templates from a block that as not yet been added.
I want to display the list of templates available when entering data for the first time in a block.
so the blockObjectId is none existent yet.
I think I might have a problem since I'm trying to get the block custom templates from a block that as not yet been added.
I want to display the list of templates available when entering data for the first time in a block.
so the blockObjectId is none existent yet.
> I think I might have a problem since I'm trying to get the
> block custom templates from a block that as not
> yet been added.
Not a problem. Use...
Templates are not specific to block instances; they are common to all blocks of a specific type - hence the reason the template list method is in the BlockType class.
-Steve
> block custom templates from a block that as not
> yet been added.
Not a problem. Use...
$bt = BlockType::getByHandle('my_block_type_handle'); // ...
Templates are not specific to block instances; they are common to all blocks of a specific type - hence the reason the template list method is in the BlockType class.
-Steve
Not sure if I explain it correctly.
I'm talking about a PACKAGE/block that I'm creating.
I want to display a SELECTBOX that will list the available templates but with the method I found, I'm able to list it only if the block ID as been created (so thats mean after it's saved and I reedit the block).
BUT when I ADD a new block, it is not created yet until I press save so I have a error.
I'm talking about a PACKAGE/block that I'm creating.
I want to display a SELECTBOX that will list the available templates but with the method I found, I'm able to list it only if the block ID as been created (so thats mean after it's saved and I reedit the block).
BUT when I ADD a new block, it is not created yet until I press save so I have a error.
> I'm talking about a PACKAGE/block
> that I'm creating.
It doesn't matter where your code is; the getByHandle() method should work.
> with the method I found, I'm able to list it only
> if the block ID as been created
The getByHandle() method does not require a block ID. Have you tried it?
If you provide additional information or some code snippets, perhaps we can help further.
-Steve
> that I'm creating.
It doesn't matter where your code is; the getByHandle() method should work.
> with the method I found, I'm able to list it only
> if the block ID as been created
The getByHandle() method does not require a block ID. Have you tried it?
If you provide additional information or some code snippets, perhaps we can help further.
-Steve
ok yes, I see. I'll give it a try brb on this
Thank :)
Thank :)
See method getBlockTypeCustomTemplates() in...
concrete/models/block_types.php
Find an example of usage in...
concrete/elements/block_custom_template.php
-Steve