-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumber.php
73 lines (58 loc) · 1.69 KB
/
number.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* @package com_zoo
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// register ElementRepeatable class
App::getInstance('zoo')->loader->register('ElementRepeatable', 'elements:repeatable/repeatable.php');
/*
Class: ElementNumber
The Number element class
*/
class ElementNumber extends ElementRepeatable implements iRepeatSubmittable {
/*
Function: _hasValue
Checks if the repeatables element's value is set.
Parameters:
$params - render parameter
Returns:
Boolean - true, on success
*/
protected function _hasValue($params = array()) {
$value = $this->get('value', $this->config->get('default'));
return !empty($value) || $value === '0';
}
/*
Function: _getSearchData
Get repeatable elements search data.
Returns:
String - Search data
*/
protected function _getSearchData() {
return $this->get('value', $this->config->get('default'));
}
/*
Function: _edit
Renders the repeatable edit form field.
Returns:
String - html
*/
protected function _edit() {
return '<input '.($this->config->get('required', 0) ? 'required="true"' : '').' type="'.$this->config->get('type', 'number').'" name="'.$this->getControlName('value').'" value="'.$this->get('value', $this->config->get('default')).'"/>';;
}
/*
Function: _renderSubmission
Renders the element in submission.
Parameters:
$params - AppData submission parameters
Returns:
String - html
*/
public function _renderSubmission($params = array()) {
return $this->_edit();
}
}