Пример #1
0
 /**
  * Create new config object
  *
  * @param ThemeInterface $theme
  * @return mixed
  * @throws \Magento\Framework\Exception
  */
 public function create(ThemeInterface $theme)
 {
     if (!isset($this->_types[$theme->getType()])) {
         throw new \Magento\Framework\Exception(sprintf('Invalid type of theme domain model "%s"', $theme->getType()));
     }
     $class = $this->_types[$theme->getType()];
     return $this->_objectManager->create($class, ['theme' => $theme]);
 }
Пример #2
0
 /**
  * Reset parent themes by type
  *
  * @param ThemeInterface $theme
  * @return int|null
  */
 protected function _getResetParentId(ThemeInterface $theme)
 {
     $parentTheme = $theme->getParentTheme();
     while ($parentTheme) {
         foreach ($this->_allowedRelations as $typesSequence) {
             list($parentType, $childType) = $typesSequence;
             if ($theme->getType() == $childType && $parentTheme->getType() == $parentType) {
                 return $parentTheme->getId();
             }
         }
         $parentTheme = $parentTheme->getParentTheme();
     }
     return null;
 }