# contact-forms/1.9.2/classes/Element/Sort.php

Contact Forms by Cimatti, version 1.9.2. 27 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/1.9.2/code/classes/Element/Sort.php
- Raw: https://pluginprobe.com/plugins/contact-forms/1.9.2/raw/classes/Element/Sort.php
- Modified: 2023-03-14T12:04:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/1.9.2/code/classes/Element/Sort.php#L10-L20`.

```php
<?php
class AccuaForm_Element_Sort extends AccuaForm_OptionElement {
	protected $jQueryOptions;

	public function jQueryDocumentReady() {
		echo 'jQuery("#', $this->attributes["id"], ' ul").sortable(', $this->jQueryOptions(), ');';
		echo 'jQuery("#', $this->attributes["id"], ' ul").disableSelection();';
	}

	public function render() { 
		if(substr($this->attributes["name"], -2) != "[]")
			$this->attributes["name"] .= "[]";

		echo '<div id="', $this->attributes["id"], '"><ul>';
		foreach($this->options as $value => $text) {
			$value = $this->getOptionValue($value);
			echo '<li class="ui-state-default"><input type="hidden" name="', $this->attributes["name"], '" value="', $value, '"/>', $text, '</li>';
		}	
		echo "</ul></div>";
	}

	public function renderCSS() {
		echo '#', $this->attributes["id"], ' ul { list-style-type: none; margin: 0; padding: 0; cursor: pointer; }';
		echo '#', $this->attributes["id"], ' ul li { margin: 0.25em 0; padding: 0.5em; font-size: 1em; }';
	}
}

```
