1

I've created a view and I want to manipulate the field output to show bar graph instead of field value.

I'm using bootstrap 3's progress bar as the bar graph, but I'm unable to set width of the progress bar to show progress as drupal doesn't allows style attribute inside "Rewrite the output of this field" in views.

So, I decided to create that field's tpl file now the problem is how can I access the Replacement tokens in the tpl file that are available in "Rewrite the output of this field"

$data = $row->{$field->field_alias} this prints numbers 1 2 3 4 5 ....

1 Answer 1

0

Under the Field settings, you can add a class to the field:

enter image description here

this can accept replacement tokens, so for example you could:

  • create 5 classes each with a different length
  • add a field prior to this field that will calculate the correct length
  • use the replacement token of the calculated field to include the proper class: barsize1, barsize2, barsize3, etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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