本文整理汇总了PHP中FormField::addFieldTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::addFieldTypes方法的具体用法?PHP FormField::addFieldTypes怎么用?PHP FormField::addFieldTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::addFieldTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: to_database
}
function to_database($prio)
{
return $prio instanceof Priority ? array($prio->getDesc(), $prio->getId()) : $prio;
}
function toString($value)
{
return $value instanceof Priority ? $value->getDesc() : $value;
}
function getConfigurationOptions()
{
return array('prompt' => new TextboxField(array('id' => 2, 'label' => 'Prompt', 'required' => false, 'default' => '', 'hint' => 'Leading text shown before a value is selected', 'configuration' => array('size' => 40, 'length' => 40))));
}
}
FormField::addFieldTypes('Built-in Lists', function () {
return array('priority' => array('Priority Level', PriorityField));
});
class Widget
{
function __construct($field)
{
$this->field = $field;
$this->name = $field->getFormName();
}
function parseValue()
{
$this->value = $this->getValue();
if (!isset($this->value) && is_object($this->field->getAnswer())) {
$this->value = $this->field->getAnswer()->getValue();
}
if (!isset($this->value) && isset($this->field->value)) {
示例2: create
static function create($ht = false)
{
$inst = parent::create($ht);
$inst->set('created', new SqlFunction('NOW'));
return $inst;
}
static function getSelections()
{
$selections = array();
foreach (DynamicList::objects() as $list) {
$selections['list-' . $list->id] = array($list->getPluralName(), SelectionField, $list->get('id'));
}
return $selections;
}
}
FormField::addFieldTypes('Custom Lists', array('DynamicList', 'getSelections'));
/**
* Represents a single item in a dynamic list
*
* Fields:
* value - (char * 255) Actual list item content
* extra - (char * 255) Other values that represent the same item in the
* list, such as an abbreviation. In practice, should be a
* space-separated list of tokens which should hit this list item in a
* search
* sort - (int) If sorting by this field, represents the numeric sort order
* that this item should come in the dropdown list
*/
class DynamicListItem extends VerySimpleModel
{
static $meta = array('table' => LIST_ITEM_TABLE, 'pk' => array('id'), 'joins' => array('list' => array('null' => true, 'constraint' => array('list_id' => 'DynamicList.id'))));
示例3: foreach
{
$this->ht['default'] = '';
if (!$this->_choices) {
foreach (static::$_flags as $k => $v) {
$this->_choices[$k] = $v['name'];
}
}
return $this->_choices;
}
function getConfigurationOptions()
{
return array('prompt' => new TextboxField(array('id' => 2, 'label' => 'Prompt', 'required' => false, 'default' => '', 'hint' => 'Leading text shown before a value is selected', 'configuration' => array('size' => 40, 'length' => 40))));
}
}
FormField::addFieldTypes('Dynamic Fields', function () {
return array('flags' => array('Ticket Flags', TicketFlagField, false));
});
class FileUploadField extends FormField
{
static $widget = 'FileUploadWidget';
protected $attachments;
static function getFileTypes()
{
static $filetypes;
if (!isset($filetypes)) {
$filetypes = YamlDataParser::load(INCLUDE_DIR . '/config/filetype.yaml');
}
return $filetypes;
}
function getConfigurationOptions()
{