Exemple #1
0
 /**
  * build the module.
  * YEAH this is it.
  * All other classes in this module only serve the next 30-ish lines
  *
  * @return $this
  * @throws \Exception
  */
 public function build()
 {
     if (!$this->module) {
         throw new \Exception("Module not set for builder");
     }
     foreach ($this->sourceConfig->getConfig('file') as $fileConfig) {
         $fileConfig = $this->preProcessFileConfig($fileConfig);
         $scope = $fileConfig['scope'];
         $type = $fileConfig['type'];
         $generator = $this->getGenerator($scope . '.' . $type);
         $files = $generator->setConfig($fileConfig)->setModule($this->module)->generate();
         foreach ($files as $name => $content) {
             $this->files[$name] = $content;
         }
     }
     $basePath = $this->module->getSettings()->getXmlRootPath() . '/' . $this->module->getNamespace() . '/' . $this->module->getModuleName() . '/';
     $this->writer->setPath($basePath);
     foreach ($this->files as $name => $file) {
         $destinationFile = $name;
         $this->writer->write($destinationFile, $file);
     }
     //wrap it up
     $this->createArchive();
     //clean it up
     $this->cleanup();
     //write the list of files
     $this->writeLog();
     $this->writeUninstall();
     return $this;
 }
Exemple #2
0
 /**
  * get field label
  *
  * @param $fieldCode
  * @param $scope
  * @return string
  */
 public function getFieldLabel($fieldCode, $scope)
 {
     $field = $this->findField($fieldCode, $scope);
     if ($field) {
         return __($field['label']);
     }
     //look in the depend_labels
     $key = $this->getEntityCode($scope);
     if ($key) {
         $dependLabel = $this->sourceConfig->getConfig('depend_labels/' . $key . '/depend_label/' . $fieldCode . '/label');
         if ($dependLabel) {
             return $dependLabel;
         }
     }
     return $fieldCode;
 }