Contao\Widget::__construct PHP Method

__construct() public method

Initialize the object
public __construct ( array $arrAttributes = null )
$arrAttributes array An optional attributes array
    public function __construct($arrAttributes = null)
    {
        parent::__construct();
        // Override the output format in the front end
        if (TL_MODE == 'FE') {
            /** @var PageModel $objPage */
            global $objPage;
            if ($objPage->outputFormat != '') {
                $this->strFormat = $objPage->outputFormat;
            }
        }
        $this->addAttributes($arrAttributes);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Initialize the object
  *
  * @param array $arrAttributes An optional attributes array
  */
 public function __construct($arrAttributes = null)
 {
     parent::__construct($arrAttributes);
     $this->arrAttributes['maxlength'] = 2;
     $this->strCaptchaKey = 'c' . md5(uniqid(mt_rand(), true));
     $this->arrAttributes['required'] = true;
     $this->arrConfiguration['mandatory'] = true;
 }
All Usage Examples Of Contao\Widget::__construct