rushy Posted August 22 Share Posted August 22 I'm wondering if the 'built in' description field of the Image Fieldtype can be used in front end editing? I presume not, as usually one would set front end editing in the input tab when defining a field in the back end but the description text field is included with the Image type. But I thought I'd check here in case any one know for sure. My case is I have a textarea field where multi line text is entered and stored like an article about the image, so I used the description field, and this works fine for plain text. Now I realise this may have been a mistake, as I would like to use TinyMCE editor and front end edit to create and edit these articles and I don't think it can work with the built in description, probably I should use a user defined image-field attached to the image field. Any comments welcome. Link to comment Share on other sites More sharing options...
wbmnfktr Posted August 22 Share Posted August 22 In my Front-End Page Editor settings there aren't even any image fields listed, so I guess: No, not possible. Maybe there are hooks or other ways to achieve that, but I wouldn't bet on this. Just an idea and never tried it but what about using a custom/different field like image_description (text or textarea field) you show somewhere in the frontend/on the page but only for admins, so you can edit it, and use it for the image desription by referencing it in the image tag. This way you can activate it for frontend-editing, edit it, and use it with the image. Multiple images wouldn't work here. // the normal way <img src="<?php echo $page->image->url(); ?>" alt="<?php echo $page->image->description; ?>" /> // the other way <?php if($user->isLoggedIn()):?> <div class="show-image-description-text-to-edit-in-front-end"> <?php echo $page->image_description; ?> </div> <?php endif;?> <img src="<?php echo $page->image->url(); ?>" alt="<?php echo $page->image_description; ?>" /> Link to comment Share on other sites More sharing options...
rushy Posted August 23 Author Share Posted August 23 13 hours ago, wbmnfktr said: In my Front-End Page Editor settings there aren't even any image fields listed, so I guess: No, not possible. Maybe there are hooks or other ways to achieve that, but I wouldn't bet on this. Just an idea and never tried it but what about using a custom/different field like image_description (text or textarea field) you show somewhere in the frontend/on the page but only for admins, so you can edit it, and use it for the image desription by referencing it in the image tag. This way you can activate it for frontend-editing, edit it, and use it with the image. Multiple images wouldn't work here. // the normal way <img src="<?php echo $page->image->url(); ?>" alt="<?php echo $page->image->description; ?>" /> // the other way <?php if($user->isLoggedIn()):?> <div class="show-image-description-text-to-edit-in-front-end"> <?php echo $page->image_description; ?> </div> <?php endif;?> <img src="<?php echo $page->image->url(); ?>" alt="<?php echo $page->image_description; ?>" /> Thank you for the suggestion. Investigating further I have found out that PW has a useful trick up it's sleeve (as usual!). One can define a template named after an existing field by prepending the template name with field- e.g for the images field in my site, I made a template (without a file) called field-images and in that template I defined a new text field called imgDescription. Now every instance of an image also has a text field associated with like this: $image->imgDescription and this works as expected, for multiple images too. I think I will proceed with this as see how I get on... ! 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted August 23 Share Posted August 23 Damn... you are right. That should probably work even better. Always forget that we have that option. Sorry. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now