0

Has anyone seen a plugin or a method where I can set a description for a category field?

I have a client who is uploading wrong image dimensions to the category image field. I want to suggest "please use 500x500" for example.

enter image description here

1

No add-ons I'm aware of, as most deal with the initial display of categories and groups, rather than the editing page (e.g. Category Construct).

But you could modify the language file for the admin interface and change the title:

expressionengine/language/english/admin_content_lang.php line 604:

'category_image' =>
'Category Image',

'category_img_blurb' =>
'This is an optional field that enables you to assign an image to your categories.',

Ignore the 'category_img_blurb' reference as it would seem that's now redundant and not used.

Or if you really want to hack it, expressionengine/views/admin/category_edit.php line 38 onwards, change to look like this:

<div class="category_field">
    <?=form_label(lang('category_image'), 'cat_image')?>
    <?=$cat_image?>
    <span><?=lang('category_img_blurb')?></span>
    <?php if (isset($cat_image_error) AND $cat_image_error !== ''): ?>
        <span class="notice"><?=$cat_image_error?></span>
        <br />
    <?php endif ?>
</div>

Added this line in: <span><?=lang('category_img_blurb')?></span>

Update - Just thought of a better way. Install this addon. Then add something like this to the JS:

$('.pageContents form .category_field label[for="cat_image"]').after('<p>Description of your category field</p>');
  • Thanks for this, could I maybe somehow override the "category_image" param in my EE config file? Your suggestion, though a good one, will just get overwritten in an update without any dev realising. – joe May 19 '15 at 12:53
  • Yep - not ideal. Even a Control Panel theme doesn't overwrite the languages. Have dreamed up a better solution and edited answer. – Peter Lewis May 19 '15 at 14:58
  • Damnit! Well yes thank you that's a good idea I shall try that, thank you! – joe May 20 '15 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.