Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TextConfigOption.php
Go to the documentation of this file.
1 <?php
7 
12 {
16  const FRONTEND_WIZARD_TEXT = 'text';
17  const FRONTEND_WIZARD_PASSWORD = 'password';
18  const FRONTEND_WIZARD_TEXTAREA = 'textarea';
32  public function __construct(
33  $name,
34  $frontendType,
35  $configPath,
36  $description = '',
37  $defaultValue = null,
38  $shortCut = null
39  ) {
40  if ($frontendType != self::FRONTEND_WIZARD_TEXT && $frontendType != self::FRONTEND_WIZARD_PASSWORD &&
41  $frontendType != self::FRONTEND_WIZARD_TEXTAREA
42  ) {
43  throw new \InvalidArgumentException("Frontend input type has to be 'text', 'textarea' or 'password'.");
44  }
45  parent::__construct(
46  $name,
47  $frontendType,
48  self::VALUE_REQUIRED,
49  $configPath,
51  $defaultValue,
52  $shortCut
53  );
54  }
55 
63  public function validate($data)
64  {
65  if (!is_string($data)) {
66  throw new \InvalidArgumentException("'{$this->getName()}' must be a string");
67  }
68  parent::validate($data);
69  }
70 }
__construct( $name, $frontendType, $configPath, $description='', $defaultValue=null, $shortCut=null)
if(!isset($_GET['name'])) $name
Definition: log.php:14