本文整理汇总了PHP中JFormFieldList::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormFieldList::setup方法的具体用法?PHP JFormFieldList::setup怎么用?PHP JFormFieldList::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormFieldList
的用法示例。
在下文中一共展示了JFormFieldList::setup方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Method to attach a JForm object to the field.
*
* @param object $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @since 11.1
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
$defaultToTableValue = $this->element->attributes()->default_to_table;
if ($defaultToTableValue) {
$defaultToTableValue = (bool) $this->element->attributes()->{$defaultToTableValue}[0];
} else {
$defaultToTableValue = true;
}
if ($this->value == '' && $return && $defaultToTableValue) {
$db = JFactory::getDbo();
/*
* Attempt to get the real Db collation (tmp fix before this makes it into J itself
* see - https://github.com/joomla/joomla-cms/pull/2092
*/
$db->setQuery('SHOW VARIABLES LIKE "collation_database"');
try {
$res = $db->loadObject();
if (isset($res->Value)) {
$this->value = $res->Value;
}
} catch (RuntimeException $e) {
$this->value = $db->getCollation();
}
}
return $return;
}
示例2: testGetInput
/**
* Test the getInput method.
*/
public function testGetInput()
{
$form = new JFormInspector('form1');
$this->assertThat(
$form->load('<form><field name="list" type="list" /></form>'),
$this->isTrue(),
'Line:'.__LINE__.' XML string should load successfully.'
);
$field = new JFormFieldList($form);
$this->assertThat(
$field->setup($form->getXml()->field, 'value'),
$this->isTrue(),
'Line:'.__LINE__.' The setup method should return true.'
);
$this->assertThat(
strlen($field->input),
$this->greaterThan(0),
'Line:'.__LINE__.' The getInput method should return something without error.'
);
// TODO: Should check all the attributes have come in properly.
}
示例3: setup
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
// On change must always be the change context function
$this->onchange = 'dpFieldsChangeContext(jQuery(this).val());';
return $return;
}
示例4: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$this->folder = (string) $this->element['folder'];
}
return $return;
}
示例5: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$this->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : '';
}
return $return;
}
示例6: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$this->keyField = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
$this->valueField = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
$this->translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
$this->query = (string) $this->element['query'];
}
return $return;
}
示例7: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$this->filter = (string) $this->element['filter'];
$this->exclude = (string) $this->element['exclude'];
$this->stripPrefix = (string) $this->element['stripprefix'];
$this->defaultLabel = (string) $this->element['defaultlabel'];
$hideNone = (string) $this->element['hide_none'];
$this->hideNone = $hideNone == 'true' || $hideNone == 'hideNone' || $hideNone == '1';
$hideDefault = (string) $this->element['hide_default'];
$this->hideDefault = $hideDefault == 'true' || $hideDefault == 'hideDefault' || $hideDefault == '1';
$stripExt = (string) $this->element['stripext'];
$this->stripExt = $stripExt == 'true' || $stripExt == 'stripExt' || $stripExt == '1';
// Get the path in which to search for file options.
$this->directory = (string) $this->element['directory'];
}
return $return;
}
示例8: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$this->checkedOptions = (string) $this->element['checked'];
}
return $return;
}
示例9: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
// Check if its using the old way
$this->query = (string) $this->element['query'];
if (empty($this->query)) {
// Get the query from the form
$query = array();
$defaults = array();
$query['select'] = (string) $this->element['sql_select'];
$query['from'] = (string) $this->element['sql_from'];
$query['join'] = isset($this->element['sql_join']) ? (string) $this->element['sql_join'] : '';
$query['where'] = isset($this->element['sql_where']) ? (string) $this->element['sql_where'] : '';
$query['group'] = isset($this->element['sql_group']) ? (string) $this->element['sql_group'] : '';
$query['order'] = (string) $this->element['sql_order'];
// Get the filters
$filters = isset($this->element['sql_filter']) ? explode(",", $this->element['sql_filter']) : '';
// Get the default value for query if empty
if (is_array($filters)) {
foreach ($filters as $key => $val) {
$name = "sql_default_{$val}";
$attrib = (string) $this->element[$name];
if (!empty($attrib)) {
$defaults[$val] = $attrib;
}
}
}
// Process the query
$this->query = $this->processQuery($query, $filters, $defaults);
}
$this->keyField = isset($this->element['key_field']) ? (string) $this->element['key_field'] : 'value';
$this->valueField = isset($this->element['value_field']) ? (string) $this->element['value_field'] : (string) $this->element['name'];
$this->translate = isset($this->element['translate']) ? (string) $this->element['translate'] : false;
$this->header = $this->element['header'] ? (string) $this->element['header'] : false;
}
return $return;
}
示例10: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 1.2.0
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$attributes = array('exclude', 'class');
/* class is @deprecated >= J3.2 */
foreach ($attributes as $attributeName) {
if (isset($element[$attributeName])) {
$this->__set($attributeName, $element[$attributeName]);
}
}
}
return $return;
}
示例11: setup
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
*
* @return boolean True on success.
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$input = \Windwalker\DI\Container::getInstance()->get('input');
$this->container = \Windwalker\DI\Container::getInstance($input->get('option'));
return parent::setup($element, $value, $group);
}