<?php namespace {{namespace_php}}\FormWidgets;

use Backend\Classes\FormWidgetBase;

/**
 * {{studly_name}} Form Widget
 *
 * @link https://docs.octobercms.com/3.x/extend/forms/form-widgets.html
 */
class {{studly_name}} extends FormWidgetBase
{
    protected $defaultAlias = '{{lower_plugin}}_{{snake_name}}';

    public function init()
    {
    }

    public function render()
    {
        $this->prepareVars();
        return $this->makePartial('{{lower_name}}');
    }

    public function prepareVars()
    {
        $this->vars['name'] = $this->formField->getName();
        $this->vars['value'] = $this->getLoadValue();
        $this->vars['model'] = $this->model;
    }

    public function loadAssets()
    {
        $this->addCss('css/{{lower_name}}.css');
        $this->addJs('js/{{lower_name}}.js');
    }

    public function getSaveValue($value)
    {
        return $value;
    }
}
