本文整理汇总了PHP中JFormField::getLayoutData方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormField::getLayoutData方法的具体用法?PHP JFormField::getLayoutData怎么用?PHP JFormField::getLayoutData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormField
的用法示例。
在下文中一共展示了JFormField::getLayoutData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
$options = array();
if ($this->value !== '') {
$options = json_decode($this->value, true);
}
$data['customData'] = $options;
return $data;
}
示例2: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
$typeId = JTable::getInstance('Contenttype')->getTypeId($this->element['data-typeAlias']);
$itemId = $this->form->getValue('id');
$label = JText::_('JTOOLBAR_VERSIONS');
$link = 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&field=' . $this->id . '&item_id=' . $itemId . '&type_id=' . $typeId . '&type_alias=' . $this->element['data-typeAlias'] . '&' . JSession::getFormToken() . '=1';
$extraData = array('type' => $typeId, 'item' => $itemId, 'label' => $label, 'link' => $link);
return array_merge($data, $extraData);
}
示例3: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
// Load the current username if available.
$project = new Crowdfunding\Project(JFactory::getDbo());
$projectTitle = '';
if (is_numeric($this->value)) {
$project->load($this->value);
$projectTitle = $project->get('title');
}
$extraData = array('projectTitle' => $projectTitle);
return array_merge($data, $extraData);
}
示例4: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
// Load the current username if available.
$item = new Crowdfunding\Reward(JFactory::getDbo());
$title = '';
if (is_numeric($this->value)) {
$options = array('fields' => array('a.id', 'a.title'));
$item->load($this->value, $options);
$title = $item->get('title');
}
$extraData = array('rewardTitle' => $title);
return array_merge($data, $extraData);
}
示例5: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
// Load the current username if available.
$table = JTable::getInstance('user');
if (is_numeric($this->value)) {
$table->load($this->value);
} elseif (strtoupper($this->value) == 'CURRENT') {
// 'CURRENT' is not a reasonable value to be placed in the html
$this->value = JFactory::getUser()->id;
$table->load($this->value);
} else {
$table->name = JText::_('JLIB_FORM_SELECT_USER');
}
$extraData = array('userName' => $table->name, 'groups' => $this->getGroups(), 'excluded' => $this->getExcluded());
return array_merge($data, $extraData);
}
示例6: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
// Load the current username if available.
$table = JTable::getInstance('user');
if (is_numeric($this->value)) {
$table->load($this->value);
} elseif (strtoupper($this->value) == 'CURRENT') {
// 'CURRENT' is not a reasonable value to be placed in the html
$this->value = JFactory::getUser()->id;
$table->load($this->value);
} else {
$table->name = JText::_('JLIB_FORM_SELECT_USER');
}
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
$extraData = array('onchange' => $onchange, 'userName' => $table->name, 'groups' => $this->getGroups(), 'excluded' => $this->getExcluded(), 'readOnly' => $this->readonly, 'class' => $this->class);
return array_merge($data, $extraData);
}
示例7: getLayoutData
/**
* Get the data that is going to be passed to the layout
*
* @return array
*/
public function getLayoutData()
{
// Get the basic field data
$data = parent::getLayoutData();
// Initialize value
$name = '';
if (is_numeric($this->value)) {
$name = JUser::getInstance($this->value)->name;
} elseif (strtoupper($this->value) == 'CURRENT') {
// 'CURRENT' is not a reasonable value to be placed in the html
$current = JFactory::getUser();
$this->value = $current->id;
$data['value'] = $this->value;
$name = $current->name;
} else {
$name = JText::_('JLIB_FORM_SELECT_USER');
}
$extraData = array('userName' => $name, 'groups' => $this->getGroups(), 'excluded' => $this->getExcluded());
return array_merge($data, $extraData);
}
示例8: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
// Initialize some field attributes.
$maxLength = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';
$inputmode = !empty($this->inputmode) ? ' inputmode="' . $this->inputmode . '"' : '';
$dirname = !empty($this->dirname) ? ' dirname="' . $this->dirname . '"' : '';
/* Get the field options for the datalist.
Note: getSuggestions() is deprecated and will be changed to getOptions() with 4.0. */
$options = (array) $this->getSuggestions();
$extraData = array('maxLength' => $maxLength, 'pattern' => $this->pattern, 'inputmode' => $inputmode, 'dirname' => $dirname, 'options' => $options);
return array_merge($data, $extraData);
}
示例9: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.6.3
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$extraData = array('ordering' => $this->form->getValue('ordering'), 'clientId' => $this->form->getValue('client_id'), 'name' => $this->name, 'token' => JSession::getFormToken() . '=1', 'element' => $this->form->getName() . '_' . $this->linked);
return array_merge($data, $extraData);
}
示例10: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
// Initialize some field attributes.
$columns = $this->columns ? ' cols="' . $this->columns . '"' : '';
$rows = $this->rows ? ' rows="' . $this->rows . '"' : '';
$maxlength = $this->maxlength ? ' maxlength="' . $this->maxlength . '"' : '';
$extraData = array('maxlength' => $maxlength, 'rows' => $rows, 'columns' => $columns);
return array_merge($data, $extraData);
}
示例11: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7
*/
protected function getLayoutData()
{
return parent::getLayoutData();
}
示例12: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 3.6
*/
protected function getInput()
{
$value = $this->value ? $this->value : array();
// Prepare data for renderer
$data = parent::getLayoutData();
$tmpl = null;
$forms = array();
$control = $this->name;
try {
// Prepare the form template
$formname = 'subform' . ($this->group ? $this->group . '.' : '.') . $this->fieldname;
$tmplcontrol = !$this->multiple ? $control : $control . '[' . $this->fieldname . 'X]';
$tmpl = JForm::getInstance($formname, $this->formsource, array('control' => $tmplcontrol));
// Prepare the forms for exiting values
if ($this->multiple) {
$value = array_values($value);
$c = max($this->min, min(count($value), $this->max));
for ($i = 0; $i < $c; $i++) {
$itemcontrol = $control . '[' . $this->fieldname . $i . ']';
$itemform = JForm::getInstance($formname . $i, $this->formsource, array('control' => $itemcontrol));
if (!empty($value[$i])) {
$itemform->bind($value[$i]);
}
$forms[] = $itemform;
}
} else {
$tmpl->bind($value);
$forms[] = $tmpl;
}
} catch (Exception $e) {
return $e->getMessage();
}
$data['tmpl'] = $tmpl;
$data['forms'] = $forms;
$data['min'] = $this->min;
$data['max'] = $this->max;
$data['control'] = $control;
$data['buttons'] = $this->buttons;
$data['fieldname'] = $this->fieldname;
$data['groupByFieldset'] = $this->groupByFieldset;
// Prepare renderer
$renderer = $this->getRenderer($this->layout);
// Allow to define some JLayout options as attribute of the element
if ($this->element['component']) {
$renderer->setComponent((string) $this->element['component']);
}
if ($this->element['client']) {
$renderer->setClient((string) $this->element['client']);
}
// Render
$html = $renderer->render($data);
// Add hidden input on front of the subform inputs, in multiple mode
// for allow to submit an empty value
if ($this->multiple) {
$html = '<input name="' . $this->name . '" type="hidden" value="" />' . $html;
}
return $html;
}
示例13: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.5
*/
protected function getLayoutData()
{
$lang = JFactory::getLanguage();
$data = parent::getLayoutData();
$color = strtolower($this->value);
$color = !$color ? '' : $color;
// Position of the panel can be: right (default), left, top or bottom (default RTL is left)
$position = ' data-position="' . ($lang->isRTL() && $this->position == 'default' ? 'left' : $this->position) . '"';
if (!$color || in_array($color, array('none', 'transparent'))) {
$color = 'none';
} elseif ($color['0'] != '#') {
$color = '#' . $color;
}
// Assign data for simple/advanced mode
$controlModeData = $this->control === 'simple' ? $this->getSimpleModeLayoutData() : $this->getAdvancedModeLayoutData($lang);
$extraData = array('color' => $color, 'format' => $this->format, 'keywords' => $this->keywords, 'position' => $position, 'validate' => $this->validate);
return array_merge($data, $extraData, $controlModeData);
}
示例14: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
// Initialize some field attributes.
$extraData = array('maxLength' => $this->maxLength, 'meter' => $this->meter, 'threshold' => $this->threshold, 'meter' => $this->meter);
return array_merge($data, $extraData);
}
示例15: getLayoutData
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
// Initialize some field attributes.
$extraData = array('max' => $this->max, 'min' => $this->min, 'step' => $this->step, 'value' => $this->value);
return array_merge($data, $extraData);
}