Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Label.php
Go to the documentation of this file.
1 <?php
11 
13 {
19  protected $_labelsCollection;
20 
26  public function __construct(\Magento\Framework\View\Design\Theme\Label\ListInterface $labelList)
27  {
28  $this->_labelsCollection = $labelList;
29  }
30 
37  public function getLabelsCollection($label = false)
38  {
39  $options = $this->_labelsCollection->getLabels();
40  if ($label) {
41  array_unshift($options, ['value' => '', 'label' => $label]);
42  }
43  return $options;
44  }
45 
52  {
53  return $this->toOptionArray();
54  }
55 
59  public function toOptionArray()
60  {
61  return $this->getLabelsCollection((string)new \Magento\Framework\Phrase('-- No Theme --'));
62  }
63 }
$label
Definition: details.phtml:21
__construct(\Magento\Framework\View\Design\Theme\Label\ListInterface $labelList)
Definition: Label.php:26