<?php
namespace Extension;
 use TCMS\ControlExtension;
 use TCMS\TException;
 class InputAliasDefault extends ControlExtension {
 public $option = [ 'name' => 'alias', 'field_source' => 'name', 'format' => 'acsii', 'error' => false ];
 public function render($value, $option = null) {
 if(empty($option['name']) || empty($option['field_source'])) throw new TException('Vui lòng truyền option cho extension input alias', 501);
 copy_option($this->option, $option);
 $this->addStyle(asset('/style/bootstrap.min.css'));
 echo '<input autocomplete="off" type="text" name="'.$this->option['name'].'" value="'.$value.'" data-source="'.$this->option['field_source'].'" data-format="'.$this->option['format'].'" class="input-alias-ext form-control'. ($this->option['error'] ? ' error' : '') .'" id="'.$this->option['name'].'" />';
 $this->addScript(asset('/script/jquery.min.js'));
 $this->addScript(asset('/script/input-alias-default/input-alias-default.js'));
 }
 }
 ?>