bfolliot/zf-nl2br

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.0) of this package.

Provides a ZF2 filter for the php nl2br function

1.0.0 2015-04-12 15:58 UTC

This package is not auto-updated.

Last update: 2020-08-25 13:21:49 UTC


README

Provides a ZF2 filter for the php nl2br function

Installation

BFolliot\Zf-Nl2br is available through composer. Add "BFolliot/Zf-Nl2br" to your composer.json list. You can specify the latest stable version of BFolliot\Zf-Nl2br:

"BFolliot\Zf-Nl2br": "1.0.*"

To enable the module in your config/application.config.php file, add an entry BFolliot\ZfNl2br to the list of enabled modules.

Usage

In your input filter configuration, add the nl2br filter to filter the result. An example form:

namespace Application\Form;

use Zend\InputFilter;
use Zend\Form\Form;

class Foo extends Form implements
    InputFilter\InputFilterProviderInterface
{
    public function __construct($name = null)
    {
        parent::__construct($name);

        $this->add(array(
            'name'    => 'text',
            'options' => array(
                'label' => 'Text'
            ),
            'attributes' => array(
                'type'  => 'textarea',
            ),
        ));
    }

    public function getInputFilterSpecification()
    {
        return array(
            'text'  => array(
                'required' => true,
                'filters'  => array(
                    array('name' => 'nl2br'),
                ),
            ),
        );
    }
}