Source of file InputSubmit.php

Size: 1,093 Bytes - Last Modified: 2015-12-22T09:42:40-05:00

../src/View/Helper/InputSubmit.php

123456789101112131415161718192021222324252627282930313233343536
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
37
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
38
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
3940
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
4142
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
4344
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
45
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
46
Covered by 1 test(s):
  • MvcLite\ViewHelperInputSubmitTest::testRender with data set "empty atttribs array test"
474849
<?php
/**
 * Submit Input View Helper
 *
 * @category    PHP
 * @package     MvcLite
 * @subpackage  View\Helper
 * @since       File available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */

namespace MvcLite\View\Helper;

use MvcLite\View\Helper\InputElementAbstract as InputElementAbstract;

/**
 * Submit Input View Helper class
 *
 * @category    PHP
 * @package     MvcLite
 * @subpackage  View\Helper
 * @since       Class available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */
class InputSubmit extends InputElementAbstract
{
    /**
     * renders a submit element
     *
     * @param array $attribs
     * @return string
     */
    public function render($attribs = [])
    {
        $defaults = [
            'value' => 'Submit',
            'class' => 'btn btn-default',
        ];

        $attribs = array_merge($defaults, $attribs);

        $template = '<input type="submit"!attribs>';

        return strtr($template, [
            '!attribs'  => $this->getHtmlAttribs($attribs),
        ]);
    }
}