Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PathValidator.php
Go to the documentation of this file.
1 <?php
8 
10 
17 {
23  private $structure;
24 
28  public function __construct(Structure $structure)
29  {
30  $this->structure = $structure;
31  }
32 
41  public function validate($path)
42  {
43  $allPaths = $this->structure->getFieldPaths();
44 
45  if (!array_key_exists($path, $allPaths)) {
46  throw new ValidatorException(__('The "%1" path doesn\'t exist. Verify and try again.', $path));
47  }
48 
49  return true;
50  }
51 }
__()
Definition: __.php:13