CrudKit\Data\ArrayDataProvider::addFormItemFromSchema PHP Method

addFormItemFromSchema() private method

private addFormItemFromSchema ( CrudKit\Util\FormHelper $form, $columnId, array $columnOptions )
$form CrudKit\Util\FormHelper
$columnOptions array
    private function addFormItemFromSchema(FormHelper $form, $columnId, array $columnOptions)
    {
        $type = empty($columnOptions['type']) ? 'string' : $columnOptions['type'];
        $config = ['label' => $columnOptions['label']];
        switch ($type) {
            case 'text':
            case 'string':
                $item = new TextFormItem($form, $columnId, $config);
                break;
            case 'number':
                $item = new NumberFormItem($form, $columnId, $config);
                break;
            case 'datetime':
                $item = new DateTimeFormItem($form, $columnId, $config);
                break;
            default:
                throw new \Exception("The Column Type [{$type}] is not valid.");
        }
        $form->addItem($item);
    }