Naeem Marzu Naeem Marzu - 2 years ago 303
HTML Question

Yii2 FullCalendar: how to add link button

I am using FullCalendar , its work perfectly , but i need to add href to the button className='btn' when i click on redirect to view page .

my code in controller :

public function actionIndex()
$events = event::find()->all();
foreach ($events as $eve)
$event1 = new \yii2fullcalendar\models\Event();
$patient = patient::findOne($eve->patient_id);
$event1->className='btn'; // this button that i need to add link to : ['site/view', 'id' => $id ]
$event1->id = $eve->id;
$event1->title = $patient->patient_name;
$event1->start = $eve->event_date;
$taskes[] = $event1;
return $this->render('index', [

the button i need add link

Answer Source

I think you can make like this:

$event1->url = Url::to(['site/view', 'id' => $id ]);

Look in the documentation -

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download