Hello ive been trying for years now to truncate the title whilst using the [node:body:?] token. Has anyone been able to do this? thanks/

The closest ive got is creating a module with the fiollowing code but now the title doesnt even appear

function titletrim_form_twoot_node_form_alter(&$form, &$form_state) {
$form['title']['#maxlength'] = 34;
}

Is there a way i could do this possibly just by adding something to the token or even just create a new module? Might be the module weights no?

thanks

Comments

fadgadget’s picture

ooops i wasnt using the body field after all durrrr

added this to the bit where you can add php in the UI

<?php 
$mystring = '[node:field_twoot]'; 
return drupal_substr($mystring,0,30)."..."; 
// the second number is the number of characters after which you want it to truncate
// and then it concatenates with an ellipsis
?>

sorted

fadgadget’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.