kartik\builder\TabularForm::initDataColumns PHP Method

initDataColumns() protected method

Initializes the data columns.
protected initDataColumns ( )
    protected function initDataColumns()
    {
        foreach ($this->attributes as $attribute => $settings) {
            static::checkValidSetting($attribute, $settings, 'label', 'string');
            static::checkValidSetting($attribute, $settings, 'columnOptions', 'array');
            $settings = array_replace_recursive($this->attributeDefaults, $settings);
            $label = isset($settings['label']) ? ['label' => $settings['label']] : [];
            $settings['label'] = false;
            $columnOptions = ArrayHelper::getValue($settings, 'columnOptions', []);
            if (!$this->staticOnly && isset($settings['type']) && $settings['type'] === self::INPUT_RAW) {
                $value = $settings['value'];
            } else {
                $value = $this->getCellValue($attribute, $settings);
            }
            // auto alignment for certain input types - if the `type` is setup as a Closure, then the
            // following condition will not work, and one would need to set the alignment manually.
            $alignMiddle = isset($settings['type']) && ($settings['type'] == self::INPUT_RAW || $settings['type'] == self::INPUT_STATIC || $settings['type'] == self::INPUT_CHECKBOX || $settings['type'] == self::INPUT_RADIO);
            $this->_columns[] = ArrayHelper::merge(['vAlign' => $alignMiddle ? GridView::ALIGN_MIDDLE : GridView::ALIGN_TOP], $columnOptions, $label, ['attribute' => $attribute, 'value' => $value, 'format' => 'raw']);
        }
    }