Beispiel #1
0
 public function fillModel(Model $model)
 {
     $r = parent::fillModel($model);
     if (substr($this->controller->action, 0, 4) == 'edit' && !$this->submitted()) {
         $this->password->value('');
     }
     return $r;
 }
 public function fillModel(Model $model)
 {
     if (count($model->Permissions) > 0) {
         foreach ($model->Permissions as $Permission) {
             $permissionIds[] = $Permission->id;
         }
         $permissionField = $this->fieldset->childWithAttribute('name', 'permission_id[]');
         $permissionField->select($permissionIds);
     }
     parent::fillModel($model);
 }
Beispiel #3
0
 public function fillModel(Model $model)
 {
     parent::fillModel($model);
     if (!$this->submitted() && $model instanceof Node) {
         if ($this->hasField('allowComments')) {
             $this->allowComments->checked($model->hasFlag(NodeFlag::ALLOW_COMMENTS));
         }
         if ($this->hasField('allowRSS')) {
             $this->allowRSS->checked($model->hasFlag(NodeFlag::ALLOW_RSS));
         }
         if ($this->hasField('user_id')) {
             $this->user_id->value($model->get('user_id'));
         }
     }
 }
 public function fillModel(Model $model)
 {
     parent::fillModel($model);
     if (!$this->submitted() && $model) {
         $this->allowComments->checked($model->hasFlag(BlogPostFlag::ALLOW_COMMENTS));
         $this->sticky->checked($model->hasFlag(BlogPostFlag::STICKY));
         // tags
         if (!empty($model->Tags)) {
             $tags = new IndexedArray();
             foreach ($model->Tags as $Tag) {
                 $tags[] = $Tag->get('name');
             }
             $this->tags->value($tags->implode(' '));
         }
     }
 }