PluginProbe
WP Ultimate Post Grid / 1.7.2
WP Ultimate Post Grid v1.7.2
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / vendor / vafpress / classes / control / field / sorter.php

sorter.php in WP Ultimate Post Grid 1.7.2, at vendor/vafpress/classes/control/field/sorter.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class VP_Control_Field_Sorter extends VP_Control_FieldMulti implements VP_MultiSelectable
4 {
5
6 private $_max_selection;
7
8 public function __construct()
9 {
10 parent::__construct();
11 $this->_value = array();
12 }
13
14 public static function withArray($arr = array(), $class_name = null)
15 {
16 if(is_null($class_name))
17 $instance = new self();
18 else
19 $instance = new $class_name;
20 $instance->set_max_selection(isset($arr['max_selection']) ? $arr['max_selection'] : false);
21 $instance->_basic_make($arr);
22
23 return $instance;
24 }
25
26 protected function _setup_data()
27 {
28 $opt = array(
29 'maximumSelectionSize' => $this->get_max_selection(),
30 );
31 $this->add_data('opt', VP_Util_Text::make_opt($opt));
32 $this->add_data('opt_raw', $opt);
33 parent::_setup_data();
34 }
35
36 public function render($is_compact = false)
37 {
38 $this->_setup_data();
39 $this->add_data('is_compact', $is_compact);
40 return VP_View::instance()->load('control/sorter', $this->get_data());
41 }
42
43 public function get_max_selection() {
44 return $this->_max_selection;
45 }
46
47 public function set_max_selection($_max_selection) {
48 $this->_max_selection = $_max_selection;
49 return $this;
50 }
51
52 }
53
54 /**
55 * EOF
56 */