get() public method

Retrieve a container by its code
public get ( string $code ) : array
$code string The container code
return array
 /**
  * Get scope name and scopeId
  *
  * @return void
  */
 private function initScope()
 {
     if ($this->getSection() === null) {
         $this->setSection('');
     }
     if ($this->getContainer() === null) {
         $this->setContainer('');
     }
     if ($this->getStore() === null) {
         $this->setStore('');
     }
     $scope = 'default';
     $scopeCode = 'default';
     if ($this->getStore()) {
         $scope = 'containers_stores';
         $store = $this->_storeManager->getStore($this->getStore());
         $scopeCode = $store->getId();
         if ($this->getContainer() && $this->getContainer() != "") {
             $scopeCode = $this->getContainer() . "|" . $scopeCode;
         }
     } elseif ($this->getContainer()) {
         $scope = 'containers';
         $container = $this->containersSource->get($this->getContainer());
         $scopeCode = $container['name'];
     }
     $this->setScope($scope);
     $this->setScopeCode($scopeCode);
 }
Beispiel #2
0
 /**
  * Get current container name
  *
  * @return string
  */
 public function getCurrentContainerLabel()
 {
     if ($this->getContainerCode() !== null) {
         $container = $this->containersSource->get($this->getContainerCode());
         if ($this->getContainerLabel($container)) {
             return $this->getContainerLabel($container);
         }
     }
 }