Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/yiisoft/yii2/grid/ |
Upload File : |
<?php /** * @link https://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license https://www.yiiframework.com/license/ */ namespace yii\grid; use Closure; use yii\base\InvalidConfigException; use yii\helpers\Html; /** * RadioButtonColumn displays a column of radio buttons in a grid view. * * To add a RadioButtonColumn to the [[GridView]], add it to the [[GridView::columns|columns]] configuration as follows: * * ```php * 'columns' => [ * // ... * [ * 'class' => 'yii\grid\RadioButtonColumn', * 'radioOptions' => function ($model) { * return [ * 'value' => $model['value'], * 'checked' => $model['value'] == 2 * ]; * } * ], * ] * ``` * * @author Kirk Hansen <hanski07@luther.edu> * @since 2.0.11 */ class RadioButtonColumn extends Column { /** * @var string the name of the input radio button input fields. */ public $name = 'radioButtonSelection'; /** * @var array|\Closure the HTML attributes for the radio buttons. This can either be an array of * attributes or an anonymous function ([[Closure]]) returning such an array. * * The signature of the function should be as follows: `function ($model, $key, $index, $column)` * where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered * and `$column` is a reference to the [[RadioButtonColumn]] object. * * A function may be used to assign different attributes to different rows based on the data in that row. * Specifically if you want to set a different value for the radio button you can use this option * in the following way (in this example using the `name` attribute of the model): * * ```php * 'radioOptions' => function ($model, $key, $index, $column) { * return ['value' => $model->attribute]; * } * ``` * * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. */ public $radioOptions = []; /** * {@inheritdoc} * @throws \yii\base\InvalidConfigException if [[name]] is not set. */ public function init() { parent::init(); if (empty($this->name)) { throw new InvalidConfigException('The "name" property must be set.'); } } /** * {@inheritdoc} */ protected function renderDataCellContent($model, $key, $index) { if ($this->content !== null) { return parent::renderDataCellContent($model, $key, $index); } if ($this->radioOptions instanceof Closure) { $options = call_user_func($this->radioOptions, $model, $key, $index, $this); } else { $options = $this->radioOptions; if (!isset($options['value'])) { $options['value'] = is_array($key) ? json_encode($key, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : $key; } } $checked = isset($options['checked']) ? $options['checked'] : false; return Html::radio($this->name, $checked, $options); } }