<commit_before><?php
/**
 * ActiveForm
 *
 * @author <NAME> <<EMAIL>>
 * @link http://skeeks.com/
 * @copyright 2010-2014 SkeekS (Sx)
 * @date 11.11.2014
 * @since 1.0.0
 */
namespace skeeks\cms\base\widgets;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveField;

/**
 * Class ActiveForm
 * @package skeeks\cms\modules\admin\widgets
 */
class ActiveForm extends \yii\widgets\ActiveForm
{
    /**
     * @param $model
     * @param $attribute
     * @param array $items
     * @param bool $enclosedByLabel
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldCheckboxBoolean($model, $attribute, $items = [], $enclosedByLabel = true, $fieldOptions = [])
    {
        if (!$items)
        {
            $items = \Yii::$app->cms->booleanFormat();
        }

        return $this->field($model, $attribute, $fieldOptions)->checkbox($items, $enclosedByLabel);
    }

    /**
     * @param $model
     * @param $attribute
     * @param array $items
     * @param bool $enclosedByLabel
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldRadioListBoolean($model, $attribute, $items = [], $options = [], $fieldOptions = [])
    {
        if (!$items)
        {
            $items = \Yii::$app->cms->booleanFormat();
        }

        return $this->field($model, $attribute, $fieldOptions)->radioList($items, $options);
    }

    /**
     * @param $model
     * @param $attribute
     * @param array $config
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldInputInt($model, $attribute, $config = [], $fieldOptions = [])
    {
        //Html::addCssClass($config, "sx-input-int");
        $config['class'] = ArrayHelper::getValue($config, 'class') . "form-control sx-input-int";
        //return $this->field($model, $attribute, $fieldOptions)->textInput($config);
        return $this->field($model, $attribute, $fieldOptions)->widget(
            \kartik\widgets\TouchSpin::className()
        );
    }

    /**
     * @param $model
     * @param $attribute
     * @param $items
     * @param array $config
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldSelect($model, $attribute, $items, $config = [], $fieldOptions = [])
    {
        $config = ArrayHelper::merge(
            ['size' => 1], //Опции по умолчанию
            $config
        );
        return $this->field($model, $attribute, $fieldOptions)->listBox($items, $config);
    }

    /**
     * @param $model
     * @param $attribute
     * @param $items
     * @param array $config
     * @param array $fieldOptions
     * @return ActiveField
     */
    public function fieldSelectMulti($model, $attribute, $items, $config = [], $fieldOptions = [])
    {
        $config = ArrayHelper::merge(
            $config, //Опции по умолчанию
            [
                'multiple' => 'multiple',
                'size' => 5
            ]
        );
        return $this->fieldSelect($model, $attribute, $items, $config, $fieldOptions);
    }
}<commit_msg>input int<commit_after><?php
/**
 * ActiveForm
 *
 * @author <NAME> <<EMAIL>>
 * @link http://skeeks.com/
 * @copyright 2010-2014 SkeekS (Sx)
 * @date 11.11.2014
 * @since 1.0.0
 */
namespace skeeks\cms\base\widgets;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveField;

/**
 * Class ActiveForm
 * @package skeeks\cms\modules\admin\widgets
 */
class ActiveForm extends \yii\widgets\ActiveForm
{
    /**
     * @param $model
     * @param $attribute
     * @param array $items
     * @param bool $enclosedByLabel
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldCheckboxBoolean($model, $attribute, $items = [], $enclosedByLabel = true, $fieldOptions = [])
    {
        if (!$items)
        {
            $items = \Yii::$app->cms->booleanFormat();
        }

        return $this->field($model, $attribute, $fieldOptions)->checkbox($items, $enclosedByLabel);
    }

    /**
     * @param $model
     * @param $attribute
     * @param array $items
     * @param bool $enclosedByLabel
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldRadioListBoolean($model, $attribute, $items = [], $options = [], $fieldOptions = [])
    {
        if (!$items)
        {
            $items = \Yii::$app->cms->booleanFormat();
        }

        return $this->field($model, $attribute, $fieldOptions)->radioList($items, $options);
    }

    /**
     * @param $model
     * @param $attribute
     * @param array $config
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldInputInt($model, $attribute, $config = [], $fieldOptions = [])
    {
        //Html::addCssClass($config, "sx-input-int");
        $config['class'] = ArrayHelper::getValue($config, 'class') . "form-control sx-input-int";


        /**
         *  'initval' => 3.00,
            'min' => 0,
            'max' => 100,
            'step' => 0.1,
            'decimals' => 2,
            'boostat' => 5,
            'maxboostedstep' => 10,
            'prefix' => '$',
         */

        $defaultOptions = [
            'pluginOptions' =>
            [
                'max' => 9999999999
            ]
        ];

        $pluginOptions = ArrayHelper::merge($defaultOptions, (array) $config);

        //return $this->field($model, $attribute, $fieldOptions)->textInput($config);
        return $this->field($model, $attribute, $fieldOptions)->widget(
            \kartik\touchspin\TouchSpin::className(), $pluginOptions
        );
    }

    /**
     * @param $model
     * @param $attribute
     * @param $items
     * @param array $config
     * @param array $fieldOptions
     * @return ActiveField the created ActiveField object
     */
    public function fieldSelect($model, $attribute, $items, $config = [], $fieldOptions = [])
    {
        $config = ArrayHelper::merge(
            ['size' => 1], //Опции по умолчанию
            $config
        );
        return $this->field($model, $attribute, $fieldOptions)->listBox($items, $config);
    }

    /**
     * @param $model
     * @param $attribute
     * @param $items
     * @param array $config
     * @param array $fieldOptions
     * @return ActiveField
     */
    public function fieldSelectMulti($model, $attribute, $items, $config = [], $fieldOptions = [])
    {
        $config = ArrayHelper::merge(
            $config, //Опции по умолчанию
            [
                'multiple' => 'multiple',
                'size' => 5
            ]
        );
        return $this->fieldSelect($model, $attribute, $items, $config, $fieldOptions);
    }
}
{'fraction_non_alphanumeric': 0.15415588150704632, 'fraction_numerical': 0.009347138337647398, 'mean_word_length': 2.277568331762488, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4981699', 'n_tokens_mistral': 2125, 'n_tokens_neox': 2051, 'n_words': 455}