* @copyright PayPal * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace PaypalAddons\classes\Shortcut\Form\Field; use Context; class TextInput implements FieldInteface { /** @var string*/ protected $name; /** @var string*/ protected $value; /** @var string*/ protected $label; /** @var string*/ protected $type; /** @var array*/ protected $attributes; public function __construct($name, $value, $label, $type = null, $attributes = null) { $this->setName($name); $this->setValue($value); $this->setLabel($label); $this->setType($type); $this->setAttributes($attributes); } public function render() { return Context::getContext()->smarty ->assign('name', $this->getName()) ->assign('value', $this->getValue()) ->assign('label', $this->getLabel()) ->assign('configType', $this->getType()) ->assign('attributes', $this->getAttributes()) ->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/admin/_partials/form/fields/textInput.tpl'); } /** * @return string */ public function getName() { return (string) $this->name; } /** * @param string $name * @return TextInput */ public function setName($name) { $this->name = $name; return $this; } /** * @return string */ public function getValue() { return (string) $this->value; } /** * @param string $value * @return TextInput */ public function setValue($value) { $this->value = $value; return $this; } /** * @return string */ public function getLabel() { return (string) $this->label; } /** * @param string $label * @return TextInput */ public function setLabel($label) { $this->label = $label; return $this; } /** * @return string */ public function getType() { return (string) $this->type; } /** * @param string $type * @return TextInput */ public function setType($type) { $this->type = $type; return $this; } /** * @return array */ public function getAttributes() { return (array) $this->attributes; } /** * @param array $attributes * @return TextInput */ public function setAttributes($attributes) { if (false === is_array($attributes)) { return $this; } $this->attributes = $attributes; return $this; } }