Possibly a feature request
Permalink Browser Info Environment
I have a page attribute that is essentially a thumbnail. I've added this to a block using designer pro. Upon adding the block to a page, I am not presented with the option to select an image for the attribute. Furthermore, when I save the block, I get an error saying "Object of class Concrete\Core\File\File could not be converted to string". Likely I'm doing something wrong but I did think page attributes included thumbnails. Any help would be appreciated. Thanks much.
- Ife
- Ife
Type: | Pre-Sale |
---|---|
Status: | Resolved |
Thanks for the quick reply. What I had been envisioning is that every time the block was added to the page, a user would be prompted to select a file to be associated with the thumbnail attribute. I think I was misunderstanding what the role of the page attribute was. It sounds like it is a way to echo a particular attribute value to the view. Is that correct?
You are partially right. It should echo the value. Correct. The code though was mssing the "display" part, which is needed for images and other attribute types (I only thought of text). So that's gonna be fixed in the next Block Designer Pro version. Although the "File/Image" attribute will only output a URL with the link to the file. So you will need some custom scripting if you want to output the image.
As for the selecting this every time, that is incorrect. We are talking about a page attribute, and this will not be set using a block. You will have to set page attributes in the "Attributes" section of the page. A block is not meant for that. Block Designer will only let you make use of the "echo'ing" of a specific attribute's value. Usefull if you need the name of the page, the link or a file or whatnot.
If you want to select an image within the block, you can use the "Image" field type of Block Designer. This is a fully featured field type with cropping, resizing, linking etc. etc.
Let me know if you have any more questions!
Kind regards,
Ramon
As for the selecting this every time, that is incorrect. We are talking about a page attribute, and this will not be set using a block. You will have to set page attributes in the "Attributes" section of the page. A block is not meant for that. Block Designer will only let you make use of the "echo'ing" of a specific attribute's value. Usefull if you need the name of the page, the link or a file or whatnot.
If you want to select an image within the block, you can use the "Image" field type of Block Designer. This is a fully featured field type with cropping, resizing, linking etc. etc.
Let me know if you have any more questions!
Kind regards,
Ramon
Open up the view.php file, in your application/blocks/your_block_handle directory. You will see something like this:
<?php echo Page::getCurrentPage()->getAttribute('thumbnail'); ?>
Change it into this:
<?php echo Page::getCurrentPage()->getAttribute('thumbnail', 'display'); ?>
That will actually display the page attribute, instead of retrieving the raw value (array/object). The image attribute will only display a download link though, so not sure if you'd want that? If not, then you'd have to be doing something else (custom).
What is always the case though, if you select page attribute, is that you DO NOT have to select anything yourself in the block. It will take the attribute assigned to the page. So you will have to select a value for the page. If you simply want to select an image within this very block, select the "Image" field type please! That field got everything you need, resizing, cropping etc. etc.
Kind regards,
Ramon