/** * Returns the onclick event for a list row. * @param Model $record * @return string */ public function getRecordOnClick($record) { if (!isset($this->recordOnClick)) { return null; } $columns = array_keys($record->getAttributes()); $recordOnClick = RouterHelper::parseValues($record, $columns, $this->recordOnClick); return Html::attributes(['onclick' => $recordOnClick]); }
/** * Returns a Redirect object based on supplied context and parses the model primary key. * @param string $context Redirect context, eg: create, update, delete * @param Model $model The active model to parse in it's ID and attributes. * @return Redirect */ public function makeRedirect($context = null, $model = null) { $redirectUrl = null; if (post('close') && !ends_with($context, '-close')) { $context .= '-close'; } if (post('redirect', true)) { $redirectUrl = Backend::url($this->getRedirectUrl($context)); } if ($model && $redirectUrl) { $redirectUrl = RouterHelper::parseValues($model, array_keys($model->getAttributes()), $redirectUrl); } return $redirectUrl ? Redirect::to($redirectUrl) : null; }