1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142:
<?php
/**
* MvcCore
*
* This source file is subject to the BSD 3 License
* For the full copyright and license information, please view
* the LICENSE.md file that are distributed with this source code.
*
* @copyright Copyright (c) 2016 Tom Flidr (https://github.com/mvccore)
* @license https://mvccore.github.io/docs/mvccore/5.0.0/LICENCE.md
*/
namespace MvcCore\Ext\Forms\Field\Props;
/**
* Trait for classes:
* - `\MvcCore\Ext\Forms\Fields\Textarea`
*/
trait RowsColsWrap {
/**
* The number of visible text lines for the control. `NULL` value means no `cols`
* attribute will bee rendered.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows
* @var int|NULL
*/
protected $rows = NULL;
/**
* The visible width of the text control, in average character widths. If it is
* specified, it must be a positive integer. If it is not specified, the default
* browser's value is `20`. `NULL` value means no `cols` attribute will bee rendered.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols
* @var int|NULL
*/
protected $cols = NULL;
/**
* Indicates how the control wraps text. Possible values are:
* - `'hard'`: The browser automatically inserts line breaks (`CR+LF`) so that each
* line has no more than the width of the control; the `cols` attribute
* must also be specified for this to take effect.
* - `'soft'`: The browser ensures that all line breaks in the value consist of
* a `CR+LF` pair, but does not insert any additional line breaks.
* - `'off '`: Like `soft` but changes appearance to `white-space: pre;` so line
* segments exceeding `cols` are not wrapped and the `<textarea>`
* becomes horizontally scrollable.
* If this attribute is not specified, `soft` is its default browser`s value.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-wrap
* @var string|NULL
*/
protected $wrap = NULL;
/**
* The number of visible text lines for the control. `NULL` value means no `cols`
* attribute will bee rendered.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows
* @return int|NULL
*/
public function GetRows () {
return $this->rows;
}
/**
* The number of visible text lines for the control. `NULL` value means no `cols`
* attribute will bee rendered.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows
* @param int|NULL $rows
* @return \MvcCore\Ext\Forms\Field
*/
public function SetRows ($rows) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->rows = $rows;
return $this;
}
/**
* The visible width of the text control, in average character widths. If it is
* specified, it must be a positive integer. If it is not specified, the default
* browser's value is `20`. `NULL` value means no `cols` attribute will bee rendered.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols
* @return int|NULL
*/
public function GetCols () {
return $this->cols;
}
/**
* The visible width of the text control, in average character widths. If it is
* specified, it must be a positive integer. If it is not specified, the default
* browser's value is `20`. `NULL` value means no `cols` attribute will bee rendered.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols
* @param int|NULL $columns
* @return \MvcCore\Ext\Forms\Field
*/
public function SetCols ($columns = 20) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->cols = $columns;
return $this;
}
/**
* Indicates how the control wraps text. Possible values are:
* - `'hard'`: The browser automatically inserts line breaks (`CR+LF`) so that each
* line has no more than the width of the control; the `cols` attribute
* must also be specified for this to take effect.
* - `'soft'`: The browser ensures that all line breaks in the value consist of
* a `CR+LF` pair, but does not insert any additional line breaks.
* - `'off'`: Like `soft` but changes appearance to `white-space: pre;` so line
* segments exceeding `cols` are not wrapped and the `<textarea>`
* becomes horizontally scrollable.
* If this attribute is not specified, `soft` is its default browser`s value.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-wrap
* @return string|NULL
*/
public function GetWrap () {
return $this->wrap;
}
/**
* Indicates how the control wraps text. Possible values are:
* - `'hard'`: The browser automatically inserts line breaks (`CR+LF`) so that each
* line has no more than the width of the control; the `cols` attribute
* must also be specified for this to take effect.
* - `'soft'`: The browser ensures that all line breaks in the value consist of
* a `CR+LF` pair, but does not insert any additional line breaks.
* - `'off '`: Like `soft` but changes appearance to `white-space: pre;` so line
* segments exceeding `cols` are not wrapped and the `<textarea>`
* becomes horizontally scrollable.
* If this attribute is not specified, `soft` is its default browser`s value.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-wrap
* @param string|NULL $wrap
* @return \MvcCore\Ext\Forms\Field
*/
public function SetWrap ($wrap = 'soft') {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->wrap = $wrap;
return $this;
}
}