0

when you go to structure -> taxonomy -> VOCABULARY_NAME -> manage display you will find the description field with no label, and with two available format : hidden and visible. enter image description here

I want to add new format to this field (exactly I want add the "trimmed" format) like existing in manage display of nodes...

I used the custom_formatter module, but it didn't do the trick, because the description field is of type "Term description textarea", and custom_formatter use text, text_long... types. I used some hooks to change how this field is displayed but no luck

any help will be appreciated thanks in advance.

2

This is because the description field isn't a 'field'.

It's a term property like 'title' in node content type.

You should add your own 'description' field and you should be able to use custom_formatter module to add your format 'trimmed'.

===========================================================

Edit : Update your taxonomy term

This solution use the "View Bulk Operation" module for updating your terms.

[!]First of all, make a backup of your database !!! and put your website in maintenance [!]

After module installation, create a new View based on taxonomy term Your results need to correspond at all terms you need to update.

Create a VBO field like the following screen : enter image description here

Save your View and display it on your web site. Go to the page where this View should appear and select all terms

In php script textarea enter this :

// Load a wrapper for the current term, access to value are easy now
$wTerm = entity_metadata_wrapper('taxonomy_term', $entity);
// Update your custom field (In example : field_mydescription) with description field
// use the format of description to keep same values (In example : filtred_html)
$wTerm->field_mydescription = array(
    'value'     => $wTerm->description->value(),
    'format'    => 'filtred_html'
);
// Save your modifications
$wTerm->save();

All your term should be updated. Careful, if you have too many terms to update, this operation should run in background via batch API.

Delete everything we have created for the update, put in offline minimum. That's done !

You can achieve that operation in many different ways, this is quick fix.

  • Thanks for response, the problem is that I have thousands of terms in my website having the body text in that descrtion field! maybe with a query I can replace the new added field with the description field in all terms that I have ? – Boussetta moez Jan 17 '14 at 14:22

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.