PluginProbe
Contact Forms by Cimatti / 2.2.4
Contact Forms by Cimatti v2.2.4
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / classes / Element / Sort.php

Sort.php in Contact Forms by Cimatti 2.2.4, at classes/Element/Sort.php

28 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- PFBC framework extension, HTML output is controlled
3 class AccuaForm_Element_Sort extends AccuaForm_OptionElement {
4 protected $jQueryOptions;
5
6 public function jQueryDocumentReady() {
7 echo 'jQuery("#', $this->attributes["id"], ' ul").sortable(', $this->jQueryOptions(), ');';
8 echo 'jQuery("#', $this->attributes["id"], ' ul").disableSelection();';
9 }
10
11 public function render() {
12 if(substr($this->attributes["name"], -2) != "[]")
13 $this->attributes["name"] .= "[]";
14
15 echo '<div id="', $this->attributes["id"], '"><ul>';
16 foreach($this->options as $value => $text) {
17 $value = $this->getOptionValue($value);
18 echo '<li class="ui-state-default"><input type="hidden" name="', $this->attributes["name"], '" value="', $value, '"/>', $text, '</li>';
19 }
20 echo "</ul></div>";
21 }
22
23 public function renderCSS() {
24 echo '#', $this->attributes["id"], ' ul { list-style-type: none; margin: 0; padding: 0; cursor: pointer; }';
25 echo '#', $this->attributes["id"], ' ul li { margin: 0.25em 0; padding: 0.5em; font-size: 1em; }';
26 }
27 }
28