cachedListArray() public static method

public static cachedListArray ( $params = [] )
Exemplo n.º 1
0
 public function initialize()
 {
     $type = new Select('type_id', Type::cachedListArray(['key' => 'id']));
     $type->setLabel('Type of Publication');
     $this->add($type);
     $title = new Text('title', ['required' => true]);
     $title->addValidator(new PresenceOf(['message' => 'Title can not be empty']));
     $title->setLabel('Title');
     $this->add($title);
     $slug = new Text('slug');
     $slug->setLabel('Slug');
     $this->add($slug);
     $date = new Text('date');
     $date->setLabel('Publication Date');
     $this->add($date);
     $text = new TextArea('text');
     $text->setLabel('Text');
     $this->add($text);
     $meta_title = new Text('meta_title', ['required' => true]);
     $meta_title->setLabel('meta-title');
     $this->add($meta_title);
     $meta_description = new TextArea('meta_description', ['style' => 'height:4em; min-height: inherit']);
     $meta_description->setLabel('meta-description');
     $this->add($meta_description);
     $meta_keywords = new TextArea('meta_keywords', ['style' => 'height:4em; min-height: inherit']);
     $meta_keywords->setLabel('meta-keywords');
     $this->add($meta_keywords);
     $preview_inner = new Check('preview_inner');
     $preview_inner->setLabel('Show preview image inside publication');
     $this->add($preview_inner);
     $image = new Image('preview_src');
     $image->setLabel('Thumbnail Image');
     $this->add($image);
 }
Exemplo n.º 2
0
 public function getTypeSlug()
 {
     if ($this->type_id) {
         $types = Type::cachedListArray(['key' => 'id', 'value' => 'slug']);
         if (array_key_exists($this->type_id, $types)) {
             return $types[$this->type_id];
         }
     }
 }
Exemplo n.º 3
0
 public function getTypeDisplayDate()
 {
     if ($this->type_id) {
         $types = Type::cachedListArray(['key' => 'id', 'value' => 'display_date']);
         if (array_key_exists($this->type_id, $types)) {
             return $types[$this->type_id];
         }
     }
 }