PHP Classes

File: src/Renderer/Error/AbstractErrorRender.php

Recommend this page to a friend!
  Classes of Derek McLean   HTML Forms   src/Renderer/Error/AbstractErrorRender.php   Download  
File: src/Renderer/Error/AbstractErrorRender.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: 6 years ago
Size: 698 bytes
 

Contents

Class file image Download
<?php
/**
 * User: delboy1978uk
 * Date: 04/12/2016
 * Time: 23:50
 */

namespace Del\Form\Renderer\Error;

use
DOMDocument;
use
Del\Form\Field\FieldInterface;
use
Del\Form\Traits\HasDomTrait;

abstract class
AbstractErrorRender implements ErrorRendererInterface
{
    use
HasDomTrait;

   
/**
     * AbstractErrorRender constructor.
     * @param DOMDocument $dom
     */
   
public function __construct(DOMDocument $dom)
    {
       
$this->setDom($dom);
    }

   
/**
     * @param FieldInterface $field
     * @return bool
     */
   
public function shouldRender(FieldInterface $field)
    {
        return !
$field->isValid() && ($field->isRequired() || !empty($field->getValue()));
    }
}