示例#1
0
 public function fixLabel(\Symforce\AdminBundle\Compiler\Generator\TransGeneratorNode $tr, $sf_domain)
 {
     $path = 'group.' . strtolower($this->id);
     if ($this->name) {
         $this->label = $tr->createValue($path, $this->name);
     } else {
         $this->label = $tr->createValue('sf.form.' . $path, null, $sf_domain);
     }
 }
示例#2
0
 public function lazyInitialize()
 {
     if ($this->lazy_initialized) {
         throw new \Exception('big error');
     }
     $this->lazy_initialized = true;
     if ($this->source) {
         foreach ($this->source as $name) {
             if (!isset($this->parent->children[$name])) {
                 $this->throwError("in(%s) not exists for status(`%s`)", $name, $this->name);
             }
         }
     }
     if ($this->internal) {
         $this->tr_node = $this->parent->admin_object->generator->getTransNodeByPath($this->parent->admin_object->sf_domain, 'sf.status.' . $this->name);
         if (null === $this->label) {
             $this->label = $this->name;
         }
         if (null === $this->message) {
             $this->message = $this->name;
         }
     } else {
         $this->tr_node = $this->parent->tr_node->getNodeByPath($this->name);
     }
     if ($this->label) {
         $this->label = $this->tr_node->createValue('label', $this->label);
     } else {
         $this->label = $this->tr_node->createValue('label', $this->name);
     }
     if ($this->action) {
         $this->action = $this->tr_node->createValue('action', $this->action);
     }
     /* else {
            if( !$this->internal ) {
                $this->action    = $this->tr_node->createValue( 'action', $this->name ) ;
            }
        } */
     if ($this->update) {
         $this->update = $this->tr_node->createValue('update', $this->update);
     }
     if ($this->message) {
         $this->message = $this->tr_node->createValue('message', $this->message);
     } else {
         if (false !== $this->list) {
             $this->message = $this->label;
         }
     }
     $this->target = array();
     foreach ($this->parent->children as $name => $node) {
         if ($node->source && in_array($this->name, $node->source)) {
             $this->target[] = $name;
         }
     }
     if (empty($this->target)) {
         $this->target = false;
     }
 }
示例#3
0
 public function getTransValue($type, $name, $value = null)
 {
     if (isset($this->trans_sf_values[$type][$name])) {
         if (null !== $value && $this->trans_sf_values[$type][$name]->isNull()) {
             $this->trans_sf_values[$type][$name]->setValue($value);
         }
     } else {
         $this->trans_sf_values[$type][$name] = $this->trans_sf_node->createValue($type . '.' . $name, $value);
     }
     return $this->trans_sf_values[$type][$name];
 }
示例#4
0
 public function setLabel(\Symforce\AdminBundle\Compiler\Generator\TransGeneratorNode $node, $path, $domain = null)
 {
     $this->label = $node->createValue($path . '.' . $this->key, $this->text, $domain);
 }
示例#5
0
 public function getLabel()
 {
     if (!$this->label || !$this->label instanceof \Symforce\AdminBundle\Compiler\Generator\TransGeneratorValue) {
         if (!$this->label) {
             $this->label = $this->generator->humanize(basename(str_replace('\\', '/', $this->class_name)));
         }
         if (!$this->tr_node) {
             $this->tr_node = $this->generator->getTransNodeByPath($this->tr_domain, $this->name);
         }
         $this->label = $this->tr_node->createValue('label', $this->label);
     }
     return $this->label;
 }