本文整理汇总了PHP中JFormHelper::loadFieldClass方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormHelper::loadFieldClass方法的具体用法?PHP JFormHelper::loadFieldClass怎么用?PHP JFormHelper::loadFieldClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormHelper
的用法示例。
在下文中一共展示了JFormHelper::loadFieldClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getField
public function getField($type, $attributes = array(), $field_value = '')
{
static $types = null;
$defaults = array('name' => '', 'id' => '');
if (!$types) {
jimport('joomla.form.helper');
$types = array();
}
if (!in_array($type, $types)) {
JFormHelper::loadFieldClass($type);
}
try {
$attributes = array_merge($defaults, $attributes);
$xml = new JXMLElement('<?xml version="1.0" encoding="utf-8"?><field />');
foreach ($attributes as $key => $value) {
if ('_options' == $key) {
foreach ($value as $_opt_value) {
$xml->addChild('option', $_opt_value->text)->addAttribute('value', $_opt_value->value);
}
continue;
}
$xml->addAttribute($key, $value);
}
$class = 'JFormField' . $type;
$field = new $class();
$field->setup($xml, $field_value);
return $field;
} catch (Exception $e) {
return false;
}
}
示例2: renderInput
function renderInput($values = null, $options = array())
{
if (!$this->_isCompatible) {
return '';
}
$tags = array();
if (!empty($values)) {
foreach ($values as $v) {
if (is_object($v)) {
$tags[] = $v->tag_id;
} else {
$tags[] = (int) $v;
}
}
}
if (empty($options['name'])) {
$options['name'] = 'tags';
}
if (empty($options['mode'])) {
$options['mode'] = 'ajax';
}
if (!isset($options['class'])) {
$options['class'] = 'inputbox span12 small';
}
if (!isset($options['multiple'])) {
$options['multiple'] = true;
}
$xmlConf = new SimpleXMLElement('<field name="' . $options['name'] . '" type="tag" mode="' . $options['mode'] . '" label="" class="' . $options['class'] . '" multiple="' . ($options['multiple'] ? 'true' : 'false') . '"></field>');
JFormHelper::loadFieldClass('tag');
$jform = new JForm('hikashop');
$fieldTag = new JFormFieldTag();
$fieldTag->setForm($jform);
$fieldTag->setup($xmlConf, $tags);
return $fieldTag->input;
}
示例3: displayAll
function displayAll($id, $map, $color)
{
if (HIKASHOP_J25) {
$xmlConf = new SimpleXMLElement('<field name="' . $map . '" type="color" label=""></field>');
JFormHelper::loadFieldClass('color');
$jform = new JForm('hikashop');
$fieldTag = new JFormFieldColor();
$fieldTag->setForm($jform);
$fieldTag->setup($xmlConf, $color);
return $fieldTag->input;
}
$code = '<input type="text" name="' . $map . '" id="color' . $id . '" onchange=\'applyColorExample' . $id . '()\' class="inputbox" size="10" value="' . $color . '" />' . ' <input size="10" maxlength="0" style=\'cursor:pointer;background-color:' . $color . '\' onclick="if(document.getElementById(\'colordiv' . $id . '\').style.display == \'block\'){document.getElementById(\'colordiv' . $id . '\').style.display = \'none\';}else{document.getElementById(\'colordiv' . $id . '\').style.display = \'block\';}" id=\'colorexample' . $id . '\' />' . '<div id=\'colordiv' . $id . '\' style=\'display:none;position:absolute;background-color:white;border:1px solid grey;z-index:999\'>' . $this->display($id) . '</div>';
return $code;
}
示例4: testGetInput
<?php
/**
* @package Joomla.UnitTest
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
JFormHelper::loadFieldClass('filelist');
/**
* Test class for JFormFieldFileList.
*
* @package Joomla.UnitTest
* @subpackage Form
* @since 12.1
*/
class JFormFieldFileListTest extends TestCase
{
/**
* Test the getInput method.
*
* @return void
*
* @since 12.1
*/
public function testGetInput()
{
$form = new JForm('form1');
$this->assertThat($form->load('<form><field name="filelist" type="filelist" directory="modules/mod_finder/tmpl" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
$field = new JFormFieldFileList($form);
示例5: defined
<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @subpackage form
* @copyright Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('usergroup');
/**
* Form Field class for F0F
* Joomla! user groups
*
* @package FrameworkOnFramework
* @since 2.0
*/
class F0FFormFieldUsergroup extends JFormFieldUsergroup implements F0FFormField
{
protected $static;
protected $repeatable;
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
public $rowid;
/** @var F0FTable The item being rendered in a repeatable form field */
public $item;
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
示例6: defined
<?php
/**
* @package Joomla.Libraries
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('groupedlist');
/**
* Form Field class for the Joomla CMS.
* Supports a select grouped list of template styles
*
* @package Joomla.Libraries
* @subpackage Form
* @since 1.6
*/
class JFormFieldTemplatestyle extends JFormFieldGroupedList
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'TemplateStyle';
/**
* Method to get the list of template style options
* grouped by template.
示例7: jimport
<?php
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('calendar');
class JFormFieldYearMonth extends JFormFieldCalendar
{
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
// Translate placeholder text
$hint = $this->translateHint ? JText::_($this->hint) : $this->hint;
// Initialize some field attributes.
$format = $this->format;
// Build shared the attributes array.
$attributes = array();
empty($this->class) ? null : ($attributes['class'] = $this->class);
!$this->readonly ? null : ($attributes['readonly'] = 'readonly');
!$this->disabled ? null : ($attributes['disabled'] = 'disabled');
empty($this->onchange) ? null : ($attributes['onchange'] = $this->onchange);
empty($hint) ? null : ($attributes['placeholder'] = $hint);
if ($this->required) {
$attributes['required'] = '';
$attributes['aria-required'] = 'true';
}
// Parse 'NOW' to current time
示例8: defined
/**
* @package: SobiPro Library
* @author
* Name: Sigrid Suski & Radek Suski, Sigsiu.NET GmbH
* Email: sobi[at]sigsiu.net
* Url: https://www.Sigsiu.NET
* @copyright Copyright (C) 2006 - 2015 Sigsiu.NET GmbH (https://www.sigsiu.net). All rights reserved.
* @license GNU/LGPL Version 3
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
* See http://www.gnu.org/licenses/lgpl.html and https://www.sigsiu.net/licenses.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
defined('SOBIPRO') || exit('Restricted access');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('user');
/**
* @property mixed input
*/
class SPFormFieldUser extends JFormFieldUser
{
public function setup($data)
{
foreach ($data as $k => $v) {
$this->{$k} = $v;
}
}
}
示例9: jimport
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Ozio Gallery is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright (C) 2010 Open Source Solutions S.L.U. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see RT-LICENSE.php
*/
jimport("joomla.form.formfield");
JFormHelper::loadFieldClass("list");
class JFormFieldListNanoAlbums extends JFormFieldList
{
protected $type = "ListNanoAlbums";
protected function getInput()
{
static $resources = true;
$i18n = array('public' => JText::_("COM_OZIOGALLERY3_ALBUM_PUBLIC"), 'private' => JText::_("COM_OZIOGALLERY3_ALBUM_PRIVATE"), 'protected' => JText::_("COM_OZIOGALLERY3_ALBUM_PROTECTED"), 'topublic' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPUBLIC"), 'toprivate' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPRIVATE"), 'toprotected' => JText::_("COM_OZIOGALLERY3_ALBUM_TOPROTECTED"));
if ($resources) {
$resources = false;
$document = JFactory::getDocument();
$document->addScript(JUri::root(true) . "/media/com_oziogallery3/js/listnanoalbums.js");
$document->addScript(JUri::base(true) . "/components/com_oziogallery3/js/get_id.js");
$document->addScriptDeclaration("var g_ozio_admin_buttons=" . json_encode($i18n) . ";");
$document->addStyleSheet(JUri::base(true) . "/components/com_oziogallery3/models/fields/fields.css");
}
示例10: defined
<?php
/**
* @package NoNumber Framework
* @version 16.2.2173
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2016 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
require_once dirname(__DIR__) . '/helpers/text.php';
JFormHelper::loadFieldClass('note');
class JFormFieldNN_Note extends JFormFieldNote
{
public $type = 'Note';
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$this->element = $element;
$element['label'] = $this->prepareText($element['label']);
$element['description'] = $this->prepareText($element['description']);
$element['translateDescription'] = false;
return parent::setup($element, $value, $group);
}
public function prepareText($string = '')
{
$string = trim($string);
if ($string == '') {
return '';
}
示例11: defined
<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010 - 2014 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JFormHelper::loadFieldClass('cachehandler');
/**
* Form Field class for FOF
* Joomla! cache handlers
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormFieldCachehandler extends JFormFieldCacheHandler implements FOFFormField
{
protected $static;
protected $repeatable;
/** @var FOFTable The item being rendered in a repeatable form field */
public $item;
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
public $rowid;
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
*
示例12: defined
<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @subpackage form
* @copyright Copyright (C) 2010 - 2014 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('F0F_INCLUDED') or die;
JFormHelper::loadFieldClass('accesslevel');
/**
* Form Field class for F0F
* Joomla! access levels
*
* @package FrameworkOnFramework
* @since 2.0
*/
class F0FFormFieldAccesslevel extends JFormFieldAccessLevel implements F0FFormField
{
protected $static;
protected $repeatable;
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
public $rowid;
/** @var F0FTable The item being rendered in a repeatable form field */
public $item;
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
示例13: defined
<?php
/**
* @package Joomla.Platform
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('Media');
/**
* Form Field class for the Joomla Platform.
* Provides a modal media selector including upload mechanism
*
* @package Joomla.Platform
* @subpackage Form
* @since 11.1
*/
class JFormFieldMediakey extends JFormFieldMedia
{
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'Mediakey';
/**
示例14: defined
<?php
/**
* Element: Password
*
* @package NoNumber Framework
* @version
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2015 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
JFormHelper::loadFieldClass('password');
class JFormFieldNN_Password extends JFormFieldPassword
{
public $type = 'Password';
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$this->element = $element;
$element['label'] = $this->prepareText($element['label']);
$element['description'] = $this->prepareText($element['description']);
$element['translateDescription'] = false;
return parent::setup($element, $value, $group);
}
private function prepareText($string = '')
{
$string = trim($string);
if ($string == '') {
示例15: defined
<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010 - 2015 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JFormHelper::loadFieldClass('captcha');
/**
* Form Field class for the FOF framework
* Supports a captcha field.
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormFieldCaptcha extends JFormFieldCaptcha implements FOFFormField
{
protected $static;
protected $repeatable;
/** @var FOFTable The item being rendered in a repeatable form field */
public $item;
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
public $rowid;
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
*