Tom*_*fin 4 php joomla joomla2.5
我在Joomla中创建了一个自定义字段类型,需要将参数传递给它.例如,我的JForm XML文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_gallery/models/fields">
<field name="images"
type="MultiImage"
label="Images"
description=""
imagetable="#__gallery_images"
imagedir="../images/gallery/originals/"
/>
</fieldset>
</form>
Run Code Online (Sandbox Code Playgroud)
我想访问自定义字段中的imagetable和imagedir属性:
<?php
// No direct access to this file
defined('_JEXEC') or die;
jimport('joomla.form.formfield');
class JFormFieldMultiImage extends JFormField
{
protected $type = 'MultiImage';
public function getInput() {
//this is where i want to access it
$input = $this->imagetable;
return $input;
}
}
Run Code Online (Sandbox Code Playgroud)
我假设你刚刚使用过$this->attributename,当我var_dump($this)看到属性被定义但它们是:protected.
我会很感激这方面的一些帮助:)
谢谢,汤姆
你真是太近了!尝试这个,让我知道它是否适合你,因为它适合我.(Joomla 2.5.6)
echo $this->element['imagedir'];
echo $this->element['imagetable'];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2671 次 |
| 最近记录: |