Prepares user input options to be passed to migrator and modeler instances.

@return void
483822
protected function prepareOptions()
    {
        $options = $this->getOptions();
        $input = [];

        foreach ($options as $option) {
            $input[] = $this->option($option[0]);
        }

        $lastnsdelim = strrpos($input[1], '\\');

        $this->options[$options[0][0]] = $input[0] ?: rtrim($this->getAppNamespace(), '\\');
        $this->options[$options[1][0]] = substr($input[1], $lastnsdelim);
        $this->options[$options[2][0]] = $input[2] ?: ExtStr::tableize($input[1]);
        $this->options[$options[3][0]] = $input[3] ?: $this->options[$options[1][0]] . 'Closure';
        $this->options[$options[4][0]] = $input[4] ?: ExtStr::tableize($input[1] . 'Closure');
        $this->options[$options[5][0]] = $input[5] ? $input[5] : './app';
        $this->options[$options[6][0]] = $input[6] ? $input[6] : './database/migrations';
        $this->options[$options[7][0]] = $input[7] ?: false;
    }
1110152
protected function _prepareForm()
    {
        $dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
        $model = $this->_coreRegistry->registry('row_data');
        $form = $this->_formFactory->create(
            ['data' => [
                            'id' => 'edit_form', 
                            'enctype' => 'multipart/form-data', 
                            'action' => $this->getData('action'), 
                            'method' => 'post'
                        ]
            ]
        );

        // Prepare CSS
        $fieldsCss = 'width:100%;';
        $readOnlyCss = 'color:#777777;background-color:#dddddd;';
        
        // HTML prefix
        $form->setHtmlIdPrefix('ckom2_grid_');

        // Freeze in edit mode state
        $freezeInEditMode = false;
        $freezeInNewMode = false;

        // Build the form
        if ($model->getEntityId()) {
            $fieldset = $form->addFieldset(
                'base_fieldset',
                ['legend' => __('Editing subscription : %1', $model->getTrackId()), 'class' => 'fieldset-wide']
            );

            // Add id field
            $fieldset->addField('id', 'hidden', ['name' => 'id']);

            // Set the frozen field state
            $freezeInEditMode = true;

        } else {
            $fieldset = $form->addFieldset(
                'base_fieldset',
                ['legend' => __('Adding Subscription'), 'class' => 'fieldset-wide']
            );

            // Set the frozen field state
            $freezeInNewMode = true;
        }

        $fieldset->addField(
            'subscription_status',
            'select',
            [
                'name' => 'subscription_status',
                'label' => __('Status'),
                'id' => 'subscription_status',
                'title' => __('Status'),
                'values' => $this->_statusOptions->getOptionArray(),
                'class' => 'status',
                'required' => true,
                'disabled' => $freezeInNewMode,
                'style' => $fieldsCss . (($freezeInNewMode) ? $readOnlyCss : ''),
            ]
        );

        $fieldset->addField(
            'start_date',
            'date',
            [
                'name' => 'start_date',
                'label' => __('Start date'),
                'id' => 'start_date',
                'title' => __('Start date'),
                'class' => 'required-entry',
                'required' => true,
                'date_format' => 'yyyy-MM-dd',
                'time_format' => 'hh:mm:ss',
                'style' => $fieldsCss,
            ]
        );

        $fieldset->addField(
            'card_id',
            'select',
            [
                'name' => 'card_id',
                'label' => __('Payment method'),
                'id' => 'card_id',
                'title' => __('Payment method'),
                'values' => $this->_userCardsOptions->getOptions(),
                'class' => 'required-entry',
                'required' => true,
                'style' => $fieldsCss,
                'after_element_html' => '<div></div>',
            ]
        );

        $fieldset->addField(
            'track_id',
            'text',
            [
                'name' => 'track_id',
                'label' => __('Track ID'),
                'id' => 'track_id',
                'title' => __('Track ID'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss. $readOnlyCss,
            ]
        );
        
        $fieldset->addField(
            'plan_id',
            'select',
            [
                'name' => 'plan_id',
                'label' => __('Payment plan'),
                'id' => 'track_id',
                'title' => __('Payment plan'),
                'values' => $this->_paymentPlanOptions->getOptionArray(),
                'class' => 'required-entry',
                'required' => true,
                'disabled' => $freezeInEditMode,
                'style' => $fieldsCss . (($freezeInEditMode) ? $readOnlyCss : ''),
            ]
        );

        $fieldset->addField(
            'user_id',
            'select',
            [
                'name' => 'user_id',
                'label' => __('Customer'),
                'id' => 'user_id',
                'title' => __('Customer'),
                'values' => $this->_userListOptions->getOptionArray(),
                'class' => 'required-entry',
                'required' => true,
                'disabled' => $freezeInEditMode,
                'style' => $fieldsCss . (($freezeInEditMode) ? $readOnlyCss : ''),
            ]
        );

        $fieldset->addField(
            'recurring_count_left',
            'text',
            [
                'name' => 'recurring_count_left',
                'label' => __('Recurring count left'),
                'id' => 'recurring_count_left',
                'title' => __('Recurring count left'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss. $readOnlyCss,
                'after_element_html' => $this->_renderTooltip('Number of transactions remaining in the recurring plan.'),
            ]
        );

        $fieldset->addField(
            'total_collection_count',
            'text',
            [
                'name' => 'total_collection_count',
                'label' => __('Total collection count'),
                'id' => 'total_collection_count',
                'title' => __('Total collection count'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss. $readOnlyCss,
                'after_element_html' => $this->_renderTooltip('Total number of transactions that will be applied against the card.'),
            ]
        );

        $fieldset->addField(
            'total_collection_value',
            'text',
            [
                'name' => 'total_collection_value',
                'label' => __('Total collection value'),
                'id' => 'total_collection_value',
                'title' => __('Total collection value'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss. $readOnlyCss,
                'after_element_html' => $this->_renderTooltip('Total value of transactions that will be applied against the card.'),
            ]
        );

        $fieldset->addField(
            'previous_recurring_date',
            'text',
            [
                'name' => 'previous_recurring_date',
                'label' => __('Previous recurring date'),
                'id' => 'previous_recurring_date',
                'title' => __('Previous recurring date'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss. $readOnlyCss,
                'after_element_html' => $this->_renderTooltip('Date of last recurring transaction in "YYYY-MM-DD" format.'),
            ]
        );

        $fieldset->addField(
            'next_recurring_date',
            'text',
            [
                'name' => 'next_recurring_date',
                'label' => __('Next recurring date'),
                'id' => 'next_recurring_date',
                'title' => __('Next recurring date'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss. $readOnlyCss,
                'after_element_html' => $this->_renderTooltip('Date of the next recurring transaction in "YYYY-MM-DD" format. This is especially useful when the merchant has applied a double recurring plan.'),
            ]
        );

        $fieldset->addField(
            'created_at',
            'text',
            [
                'name' => 'created_at',
                'label' => __('Created'),
                'id' => 'recurring_count',
                'title' => __('Created'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss . $readOnlyCss,
            ]
        );

        $fieldset->addField(
            'updated_at',
            'text',
            [
                'name' => 'updated_at',
                'label' => __('Updated'),
                'id' => 'updated_at',
                'title' => __('Updated'),
                'placeholder' => __('Generated automatically'),
                'readonly' => true,
                'style' => $fieldsCss . $readOnlyCss,
            ]
        );

        $form->setValues($model->getData());
        $form->setUseContainer(true);
        $this->setForm($form);
 
        return parent::_prepareForm();
    }
934602
public function init()
    {
        Craft::setAlias('@NerdsAndCompany/Schematic', __DIR__);

        $config = [
            'components' => [
                'elementIndexMapper' => [
                    'class' => ElementIndexMapper::class,
                ],
                'emailSettingsMapper' => [
                    'class' => EmailSettingsMapper::class,
                ],
                'generalSettingsMapper' => [
                    'class' => GeneralSettingsMapper::class,
                ],
                'modelMapper' => [
                    'class' => ModelMapper::class,
                ],
                'pluginMapper' => [
                    'class' => PluginMapper::class,
                ],
                'userSettingsMapper' => [
                    'class' => UserSettingsMapper::class,
                ],
            ],
            'dataTypes' => [
                'plugins' => PluginDataType::class,
                'sites' => SiteDataType::class,
                'volumes' => VolumeDataType::class,
                'assetTransforms' => AssetTransformDataType::class,
                'emailSettings' => EmailSettingsDataType::class,
                'fields' => FieldDataType::class,
                'generalSettings' => GeneralSettingsDataType::class,
                'sections' => SectionDataType::class,
                'globalSets' => GlobalSetDataType::class,
                'categoryGroups' => CategoryGroupDataType::class,
                'tagGroups' => TagGroupDataType::class,
                'userGroups' => UserGroupDataType::class,
                'userSettings' => UserSettingsDataType::class,
                'elementIndexSettings' => ElementIndexDataType::class,
            ],
        ];

        Craft::configure($this, $config);

        parent::init();
    }
1084476
public function prepareVars()
    {
        $this->vars['field'] = $this->formField;
        $this->vars['editorLang'] = $this->getValidEditorLang();
        $this->vars['fullPage'] = $this->fullPage;
        $this->vars['stretch'] = $this->formField->stretch;
        $this->vars['size'] = $this->formField->size;
        $this->vars['readOnly'] = $this->readOnly;
        $this->vars['name'] = $this->getFieldName();
        $this->vars['value'] = $this->getLoadValue();
        $this->vars['toolbarButtons'] = $this->evalToolbarButtons();

        $this->vars['globalToolbarButtons'] = EditorSetting::getConfigured('html_toolbar_buttons');
        $this->vars['allowEmptyTags'] = EditorSetting::getConfigured('html_allow_empty_tags');
        $this->vars['allowTags'] = EditorSetting::getConfigured('html_allow_tags');
        $this->vars['noWrapTags'] = EditorSetting::getConfigured('html_no_wrap_tags');
        $this->vars['removeTags'] = EditorSetting::getConfigured('html_remove_tags');
        $this->vars['lineBreakerTags'] = EditorSetting::getConfigured('html_line_breaker_tags');

        $this->vars['imageStyles'] = EditorSetting::getConfiguredStyles('html_style_image');
        $this->vars['linkStyles'] = EditorSetting::getConfiguredStyles('html_style_link');
        $this->vars['paragraphStyles'] = EditorSetting::getConfiguredStyles('html_style_paragraph');
        $this->vars['tableStyles'] = EditorSetting::getConfiguredStyles('html_style_table');
        $this->vars['tableCellStyles'] = EditorSetting::getConfiguredStyles('html_style_table_cell');
    }
510720
public function prepareVars()
    {
        $this->vars['cssClasses'] = implode(' ', $this->cssClasses);
        $this->vars['placeholder'] = Lang::get($this->prompt);
        $this->vars['value'] = $this->getActiveTerm();
        $this->vars['searchOnEnter'] = $this->searchOnEnter;
    }
1320636
private function _prepareColumns(): void
    {
        if (method_exists($this->_model, 'toFieldsAmiGrid')) {
            $lists = $this->_model->toFieldsAmiGrid();
        } else {
            $lists = \Schema::getColumnListing($this->_model->getTable());
        }
        if ($this->isVisibleColumn()) {
            $lists = array_diff($lists, $this->_model->getHidden());
        }
        foreach ($lists as $key => $list) {
            $this->column($list, $list)
                ->setDateActive(true)
                ->setSort(true);
        }
        $this->columnActions(function ($data) {
            $buttons = [];
            if ($this->_getConfig('routes')) {
                $pathNameForModel = strtolower(\Illuminate\Support\Str::plural(\Illuminate\Support\Str::camel(class_basename($data))));
                $buttons[] = $this->columnAction()
//                    ->setActionDelete('amigrid.delete', [$pathNameForModel, $data->id])
                    ->setUrl('/' . $pathNameForModel . '/delete')
                    ->setLabel('delete');
                $buttons[] = $this->columnAction()
//                    ->setActionShow('amigrid.show', [$pathNameForModel, $data->id])
                    ->setUrl('/' . $pathNameForModel)
                    ->setLabel('show')
//                    ->setHandler(function ($data) {
//                        return $data->id % 2;
//                    })
                ;
                $buttons[] = $this->columnAction()
//                    ->setActionEdit('amigrid.edit', [$pathNameForModel, $data->id])
                    ->setUrl('/' . $pathNameForModel . '/edit')
                    ->setLabel('edit');
            }

            return $buttons;
        });
        if ($this->_getConfig('routes')) {
            $pathNameForModel = strtolower(\Illuminate\Support\Str::plural(\Illuminate\Support\Str::camel(class_basename($this->_model))));
            $this->button()->setButtonCreate('/' . $pathNameForModel . '/create');
        }
    }
527575
public function prepareVars()
    {
        // Refresh the loaded data to support being modified by filterFields
        // @see https://github.com/octobercms/october/issues/2613
        if (!self::$onAddItemCalled) {
            $this->processExistingItems();
        }

        if ($this->previewMode) {
            foreach ($this->formWidgets as $widget) {
                $widget->previewMode = true;
            }
        }

        $this->vars['indexInputName'] = $this->indexInputName;
        $this->vars['groupInputName'] = $this->groupInputName;

        $this->vars['prompt'] = $this->prompt;
        $this->vars['formWidgets'] = $this->formWidgets;
        $this->vars['titleFrom'] = $this->titleFrom;
        $this->vars['minItems'] = $this->minItems;
        $this->vars['maxItems'] = $this->maxItems;

        $this->vars['useGroups'] = $this->useGroups;
        $this->vars['groupDefinitions'] = $this->groupDefinitions;
    }
1327357
public function prepareVars()
    {
        $this->relationModel = $this->getLoadValue();

        if ($this->formField->disabled) {
            $this->previewMode = true;
        }

        $this->vars['value'] = $this->getKeyValue();
        $this->vars['field'] = $this->formField;
        $this->vars['nameValue'] = $this->getNameValue();
        $this->vars['descriptionValue'] = $this->getDescriptionValue();
        $this->vars['listWidget'] = $this->listWidget;
        $this->vars['searchWidget'] = $this->searchWidget;
        $this->vars['title'] = $this->title;
        $this->vars['prompt'] = str_replace('%s', '<i class="icon-th-list"></i>', e(trans($this->prompt)));
    }
587274
protected function prepareForValidation(): void
    {
        $data = $this->all();

        $country = $data['country_code'] ?? null;
        $email = $data['email'] ?? null;
        $phone = $data['phone'] ?? null;
        $user = $this->user($this->route('guard'));
        $twoFactor = $user->getTwoFactor();

        if ($email !== $user->email) {
            $data['email_verified_at'] = null;
        }

        if ($phone !== $user->phone || $country !== $user->country_code) {
            $data['phone_verified_at'] = null;
        }

        if ($twoFactor || is_null($data['phone_verified_at'])) {
            array_set($twoFactor, 'phone.enabled', false);
            $data['two_factor'] = $twoFactor;
        }

        $this->replace($data);
    }
69734
public function prepareImportVars()
    {
        $this->vars['importUploadFormWidget'] = $this->importUploadFormWidget;
        $this->vars['importOptionsFormWidget'] = $this->importOptionsFormWidget;
        $this->vars['importDbColumns'] = $this->getImportDbColumns();
        $this->vars['importFileColumns'] = $this->getImportFileColumns();

        // Make these variables available to widgets
        $this->controller->vars += $this->vars;
    }
674532
protected function prepareInput()
    {
        $input = [
            'className'  => null,
            'reflection' => null,
        ];

        if (is_string($this->input)) {
            $input['className'] = $this->input;
        } else {
            extract($this->input);

            if (!isset($className)) {
                throw new Doozr_Di_Exception(
                    'Error preparing input. No className to parse defined!'
                );
            }

            $input['className'] = $className;

            if (isset($file)) {
                $this->loadFile($file);
                $input['file'] = $file;
            }

            if (isset($reflection)) {
                $input['reflection'] = $reflection;
            }
        }

        $this->input = $input;
    }
884896
private function _initialize()
    {
        $userDefinedLineBreaks = null;
        $params = $this->getParameters();
        if ($params !== null) {
            for ($i = 0, $paramsCount = count($params); $i < $paramsCount; $i++) {
                if (self::LINES_BREAKS_KEY === $params[$i]->getName()) {
                    $userDefinedLineBreaks = $params[$i]->getValue();
                    break;
                }
            }
        }

        if ($userDefinedLineBreaks !== null) {
            $this->_lineBreaks = $userDefinedLineBreaks;
        }
    }
326674
protected function preDispatchInputMode () {
		/** @var $this \MvcCore\Ext\Forms\IField */
		if ($this->inputMode !== NULL) return;
		if ($this->type === 'number') {
			if (
				(is_numeric($this->value) && floor($this->value) !== $this->value) ||
				(is_numeric($this->step) && floor($this->step) !== $this->step) ||
				(is_numeric($this->min) && floor($this->min) !== $this->min) ||
				(is_numeric($this->max) && floor($this->max) !== $this->max)
			) {
				$this->inputMode = 'decimal';
			} else {
				$this->inputMode = 'numeric';
			}
		} else if (isset(static::$fieldTypesAndInputModes[$this->type])) {
			$this->inputMode = static::$fieldTypesAndInputModes[$this->type];
		}
	}
1188433
protected function configure()
    {
        $this->setName('kaliop:migration:generate')
            ->setDescription('Generate a blank migration definition file.')
            ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The format of migration file to generate (' . implode(', ', $this->availableMigrationFormats) . ')', 'yml')
            ->addOption('type', null, InputOption::VALUE_REQUIRED, 'The type of migration to generate (' . implode(', ', $this->availableTypes) . ')', '')
            ->addOption('mode', null, InputOption::VALUE_REQUIRED, 'The mode of the migration (' . implode(', ', $this->availableModes) . ')', 'create')
            ->addOption('match-type', null, InputOption::VALUE_REQUIRED, 'The type of identifier used to find the entity to generate the migration for', null)
            ->addOption('match-value', null, InputOption::VALUE_REQUIRED, 'The identifier value used to find the entity to generate the migration for. Can have many values separated by commas', null)
            ->addOption('match-except', null, InputOption::VALUE_NONE, 'Used to match all entities except the ones satisfying the match-value condition', null)
            ->addOption('lang', 'l', InputOption::VALUE_REQUIRED, 'The language of the migration (eng-GB, ger-DE, ...). If null, the default language of the current siteaccess is used')
            ->addOption('dbserver', null, InputOption::VALUE_REQUIRED, 'The type of the database server the sql migration is for, when type=db (mysql, postgresql, ...)', 'mysql')
            ->addOption('admin-login', 'a', InputOption::VALUE_REQUIRED, "Login of admin account used whenever elevated privileges are needed (user id 14 used by default)")
            ->addOption('list-types', null, InputOption::VALUE_NONE, 'Use this option to list all available migration types and their match conditions')
            ->addArgument('bundle', InputArgument::OPTIONAL, 'The bundle to generate the migration definition file in. eg.: AcmeMigrationBundle')
            ->addArgument('name', InputArgument::OPTIONAL, 'The migration name (will be prefixed with current date)', null)
            ->setHelp(<<<EOT
The <info>kaliop:migration:generate</info> command generates a skeleton migration definition file:

    <info>php ezpublish/console kaliop:migration:generate bundleName</info>

You can optionally specify the file type to generate with <info>--format</info>, as well a name for the migration:

    <info>php ezpublish/console kaliop:migration:generate --format=json bundleName migrationName</info>

For SQL type migration you can optionally specify the database server type the migration is for with <info>--dbserver</info>:

    <info>php ezpublish/console kaliop:migration:generate --format=sql bundleName</info>

For content/content_type/language/object_state/role/section migrations you need to specify the entity that you want to generate the migration for:

    <info>php ezpublish/console kaliop:migration:generate --type=content --match-type=content_id --match-value=10,14 bundleName</info>

For role type migration you will receive a yaml file with the current role definition. You must define ALL the policies
you wish for the role. Any not defined will be removed. Example for updating an existing role:

    <info>php ezpublish/console kaliop:migration:generate --type=role --mode=update --match-type=identifier --match-value=Anonymous bundleName</info>

For freeform php migrations, you will receive a php class definition

    <info>php ezpublish/console kaliop:migration:generate --format=php bundlename classname</info>

To list all available migration types for generation, as well as the corresponding match-types, run:

    <info>php ezpublish/console ka:mig:gen --list-types</info>

Note that you can pass in a custom directory path instead of a bundle name, but, if you do, you will have to use the <info>--path</info>
option when you run the <info>migrate</info> command.
EOT
            );
    }
1116508
public function prepareVars()
    {
        $this->vars['mode'] = $this->mode;
        $this->vars['stretch'] = $this->formField->stretch;
        $this->vars['size'] = $this->formField->size;
        $this->vars['name'] = $this->getFieldName();
        $this->vars['value'] = $this->getLoadValue();
    }
511128
protected function configure()
    {
        parent::configure();

        $this
            ->setName(self::COMMAND_NAME)
            ->setAliases(array('kaliop:migration:update'))
            ->setDescription('Execute available migration definitions.')
            // nb: when adding options, remember to forward them to sub-commands executed in 'separate-process' mode
            ->addOption('admin-login', 'a', InputOption::VALUE_REQUIRED, "Login of admin account used whenever elevated privileges are needed (user id 14 used by default)")
            ->addOption('clear-cache', 'c', InputOption::VALUE_NONE, "Clear the cache after the command finishes")
            ->addOption('default-language', 'l', InputOption::VALUE_REQUIRED, "Default language code that will be used if no language is provided in migration steps")
            ->addOption('force', 'f', InputOption::VALUE_NONE, "Force (re)execution of migrations already DONE, SKIPPED or FAILED. Use with great care!")
            ->addOption('ignore-failures', 'i', InputOption::VALUE_NONE, "Keep executing migrations even if one fails")
            ->addOption('no-interaction', 'n', InputOption::VALUE_NONE, "Do not ask any interactive question")
            ->addOption('no-transactions', 'u', InputOption::VALUE_NONE, "Do not use a repository transaction to wrap each migration. Unsafe, but needed for legacy slot handlers")
            ->addOption('path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, "The directory or file to load the migration definitions from")
            ->addOption('separate-process', 'p', InputOption::VALUE_NONE, "Use a separate php process to run each migration. Safe if your migration leak memory. A tad slower")
            ->addOption('force-sigchild-enabled', null, InputOption::VALUE_NONE, "When using a separate php process to run each migration, tell Symfony that php was compiled with --enable-sigchild option")
            ->addOption('survive-disconnected-tty', null, InputOption::VALUE_NONE, "Keep on executing migrations even if the tty where output is written to gets removed. Useful if you run the command over an unstable ssh connection")
            ->addOption('child', null, InputOption::VALUE_NONE, "*DO NOT USE* Internal option for when forking separate processes")
            ->setHelp(<<<EOT
The <info>kaliop:migration:migrate</info> command loads and executes migrations:

    <info>./ezpublish/console kaliop:migration:migrate</info>

You can optionally specify the path to migration definitions with <info>--path</info>:

    <info>./ezpublish/console kaliop:migrations:migrate --path=/path/to/bundle/version_directory --path=/path/to/bundle/version_directory/single_migration_file</info>
EOT
            );
    }
1248010
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Category $category */
        $category = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('edit_fieldset', [
            'legend' => __('General Information')
        ]);

        if ($category->getId()) {
            $fieldset->addField('entity_id', 'hidden', [
                'name'  => 'entity_id',
                'value' => $category->getId(),
            ]);
        }

        $fieldset->addField('name', 'text', [
            'label'    => __('Title'),
            'name'     => 'name',
            'value'    => $category->getName(),
            'required' => true,
        ]);

        if (!$this->isHideParent($category)) {
            $categories = $this->categoryCollectionFactory->create()
                ->addAttributeToSelect('name')
                ->toOptionArray();

            $fieldset->addField('parent_id', 'radios', [
                'label'    => __('Parent Category'),
                'name'     => 'parent_id',
                'value'    => $category->getParentId() ? $category->getParentId() : 1,
                'values'   => $categories,
                'required' => true,
            ]);
        }

        $fieldset->addField('status', 'select', [
            'label'  => __('Status'),
            'name'   => 'status',
            'value'  => $category->getStatus(),
            'values' => ['0' => __('Disabled'), '1' => __('Enabled')]
        ]);

        $fieldset->addField('sort_order', 'text', [
            'label'  => __('Order'),
            'name'   => 'sort_order',
            'value'  => $category->getSortOrder(),
        ]);

        return parent::_prepareForm();
    }