Source for file repeatable.php
Documentation is available at repeatable.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* Form Field class for the Joomla Platform.
* Display a JSON loaded window with a repeatable set of sub fields
* @package Joomla.Platform
protected $type =
'Repeatable';
* Method to get the field input markup.
* @return string The field input markup.
$subForm =
new JForm($this->name, array('control' =>
'jform'));
$xml =
$this->element->children()->asXML();
// Needed for repeating modals in gmaps
$subForm->repeatCounter = (int)
@$this->form->repeatCounter;
$children =
$this->element->children();
$subForm->setFields($children);
$modalid =
$this->id .
'_modal';
$str[] =
'<div id="' .
$modalid .
'" style="display:none">';
$str[] =
'<table id="' .
$modalid .
'_table" class="adminlist ' .
$this->element['class'] .
' table table-striped">';
$attributes =
$this->element->attributes();
foreach ($subForm->getFieldset($attributes->name .
'_modal') as $field)
$names[] = (string)
$field->element->attributes()->name;
$str[] =
'<th>' .
strip_tags($field->getLabel($field->name));
$str[] =
'<br /><small style="font-weight:normal">' .
JText::_($field->description) .
'</small>';
$str[] =
'<th><a href="#" class="add btn button btn-success"><span class="icon-plus"></span> </a></th>';
$str[] =
'</tr></thead>';
foreach ($subForm->getFieldset($attributes->name .
'_modal') as $field)
$str[] =
'<td>' .
$field->getInput() .
'</td>';
$str[] =
'<div class="btn-group"><a class="add btn button btn-success"><span class="icon-plus"></span> </a>';
$str[] =
'<a class="remove btn button btn-danger"><span class="icon-minus"></span> </a></div>';
$str[] =
'</tr></tbody>';
JHtml::_('script', 'system/repeatable.js', true, true);
// If a maximum value isn't set then we'll make the maximum amount of cells a large number
$maximum =
$this->element['maximum'] ? (int)
$this->element['maximum'] :
'999';
$script =
"(function ($){
$(document).ready(function (){
var repeatable = new $.JRepeatable('$modalid', $names, '$this->id', '$maximum');
$document->addScriptDeclaration($script);
$icon =
$this->element['icon'] ?
'<i class="icon-' .
$this->element['icon'] .
'"></i> ' :
'';
$str[] =
'<button class="btn" id="' .
$modalid .
'_button" data-modal="' .
$modalid .
'">' .
$icon .
$select .
'</button>';
$str[] =
'<input type="hidden" name="' .
$this->name .
'" id="' .
$this->id .
'" value="' .
$value .
'" />';
Documentation generated on Tue, 19 Nov 2013 15:11:48 +0100 by phpDocumentor 1.4.3