1 <?php
 2 
 3 /**
 4  * @package redaxo\mediapool
 5  */
 6 class rex_form_widget_medialist_element extends rex_form_element
 7 {
 8     private $args = [];
 9 
10     // 1. Parameter nicht genutzt, muss aber hier stehen,
11     // wg einheitlicher Konstrukturparameter
12     public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
13     {
14         parent::__construct('', $table, $attributes);
15     }
16 
17     public function setCategoryId($category_id)
18     {
19         $this->args['category'] = $category_id;
20     }
21 
22     public function setTypes($types)
23     {
24         $this->args['types'] = $types;
25     }
26 
27     public function setPreview($preview = true)
28     {
29         $this->args['preview'] = $preview;
30     }
31 
32     public function formatElement()
33     {
34         static $widget_counter = 1;
35 
36         $html = rex_var_medialist::getWidget($widget_counter, $this->getAttribute('name'), $this->getValue(), $this->args);
37 
38         ++$widget_counter;
39         return $html;
40     }
41 }
42