htmlOptions in Cbreadcrumbs

The link title attribute is easy to assign a dynamic value, in menus, for example using linkOptions.

How does one assign the "title" attrubute to the breadbrumb link (also known as the tool tip) for thetileofthebreadcrumb in zii.widgets.CBreadcrumbs using

htmlOptions => array ('title)=>‘thetileofthebreadcrumb’) – in other words, what method returns links::link->title?

the links in CBreadcrumbs are generates by CHtml::link so:




$this->widget('zii.widgets.CBreadcrumbs', array(

    'links'=>array(

        'Sample post'=>array('post/view', 'id'=>12, array('title'=>'Your title here')),

        'Edit',

    ),

));



Thanks, the solution is good for static links, what about the following:

<?php if(isset($this->breadcrumbs)):?>


	<?php $this->widget('zii.widgets.CBreadcrumbs', array(


		'links'=>$this->breadcrumbs,


		'htmlOptions' => array('title'=>'titletext')


	)); ?><!-- breadcrumbs -->

Is there a way to replace the string ‘titletext’ with a method invocation to return the dynamically assigned attribute?

I am thinking that I may need to write my own extension of the zii widget. Just do not wish to do that if there is a supplied solution.

jbr, the htmlOptions you write abut in your last text are specific to the container of the breadcrumbs component. Those htmlOptions don’t have anything to do with the links that will be rendered inside that tag. if you want to add htmlOptions to the links you need to add them to the $breadcrumbs property. The property is generated in the controller file so you can just append data to that.

I understand.

Your suggestion seems obvious to me now that you have pointed it out, but I would not have arrived at it on my own

Thanks for the direction.