PHP Classes
elePHPant
Icontem

File: src/Field/Text.php

Recommend this page to a friend!
  Classes of Derek McLean  >  HTML Forms  >  src/Field/Text.php  >  Download  
File: src/Field/Text.php
Role: Class source
Content type: text/plain
Description: Class source
Class: HTML Forms
Generate and validate submitted HTML forms
Author: By
Last change:
Date: 9 months ago
Size: 1,026 bytes
 

Contents

Class file image Download
<?php
/**
 * User: delboy1978uk
 * Date: 19/11/2016
 * Time: 21:37
 */

namespace Del\Form\Field;

use
Del\Form\Filter\Adapter\FilterAdapterZf;
use
Zend\Filter\StringTrim;
use
Zend\Filter\StripTags;

class
Text extends FieldAbstract
{
   
/**
     * @return string
     */
   
public function getTag()
    {
        return
'input';
    }


    public function
init()
    {
       
$this->setAttribute('type', 'text');
       
$this->setAttribute('class', 'form-control');
       
$stringTrim = new FilterAdapterZf(new StringTrim());
       
$stripTags = new FilterAdapterZf(new StripTags());
       
$this->addFilter($stringTrim)
            ->
addFilter($stripTags);
    }

   
/**
     * @return string
     */
   
public function getPlaceholder()
    {
        return
$this->getAttribute('placeholder');
    }

   
/**
     * @param string $placeholder
     * @return $this
     */
   
public function setPlaceholder($placeholder)
    {
       
$this->setAttribute('placeholder', $placeholder);
        return
$this;
    }
}