for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LeKoala\FormElements;
use SilverStripe\Forms\TextareaField;
use SilverStripe\View\Requirements;
/**
*/
class GrowingTextarea extends TextareaField
{
use BaseElement;
LeKoala\FormElements\BaseElement
$default_config
LeKoala\FormElements\GrowingTextarea
* @config
* @var boolean
private static $enable_requirements = true;
$enable_requirements
protected $trim = false;
public function __construct($name, $title = null, $value = '', $config = null)
$config
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function __construct($name, $title = null, $value = '', /** @scrutinizer ignore-unused */ $config = null)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
parent::__construct($name, $title, $value);
$this->setRows(1);
}
public function Field($properties = array())
return $this->wrapInElement('growing-textarea', $properties);
public function setValue($value, $data = null)
parent::setValue($value, $data);
if ($this->value) {
$this->setRows(substr_count($this->value, "\n") + 1);
return $this;
public static function requirements()
Requirements::javascript("lekoala/silverstripe-form-elements: client/custom-elements/growing-textarea.min.js");
* Get the value of trim
public function getTrim()
return $this->getElementAttribute('data-trim');
* Set the value of trim
*
* @param bool $trim
public function setTrim($trim)
return $this->setElementAttribute('data-trim', $trim);