Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Index.php
Go to the documentation of this file.
1 <?php
7 
11 
22 class Index extends Template
23 {
27  private function getParamStore()
28  {
29  return $this->getRequest()->getParam('store') ?: 'all';
30  }
31 
35  private function getSchemaType()
36  {
37  if (!$this->hasSchemaTypes()) {
38  return null;
39  }
40 
41  $schemaTypeCode = $this->getRequest()->getParam(
42  'type',
43  $this->getDefaultSchemaTypeCode()
44  );
45 
46  if (!array_key_exists($schemaTypeCode, $this->getSchemaTypes())) {
47  throw new \UnexpectedValueException(
48  new Phrase('Unknown schema type supplied')
49  );
50  }
51 
52  return $this->getSchemaTypes()[$schemaTypeCode];
53  }
54 
59  public function getSchemaUrl()
60  {
61  if ($this->getSchemaType() === null) {
62  return null;
63  }
64 
65  return rtrim($this->getBaseUrl(), '/') .
66  $this->getSchemaType()->getSchemaUrlPath($this->getParamStore());
67  }
68 }