Yii Framework Forum: Prevent Htmlpurifier From Removing Id Attribute - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Prevent Htmlpurifier From Removing Id Attribute Rate Topic: -----

#1 User is offline   Stephen51 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 09-May 12

Posted 20 September 2013 - 10:11 AM

I am trying to set the id attribute of an image tag within CDetailView. At some point in the rendering process, a class called "CHtmlPurifier" is removing the id attribute. Can someone tell me how to prevent HtmlPurifier from removing the id attribute?

Following is my code:

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
	    'name',
            array(
                'label'=>'Accuracy',
                'type'=>'html',
                'value'=>$model->accuracy->percentage . '% ' . CHtml::image(Yii::app()->baseUrl.'/images/question_mark.png', 'question_mark.png', array('id'=>'accuracy_explanation')),
            )
	),
));


Thanks!
0

#2 User is offline   Stephen51 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 09-May 12

Posted 20 September 2013 - 10:26 AM

I solved the problem myself. I changed type to "raw" instead of "html" and that prevents the formatter from using CHtmlPurifier.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users