本文整理汇总了PHP中ReadonlyField::setForm方法的典型用法代码示例。如果您正苦于以下问题:PHP ReadonlyField::setForm方法的具体用法?PHP ReadonlyField::setForm怎么用?PHP ReadonlyField::setForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadonlyField
的用法示例。
在下文中一共展示了ReadonlyField::setForm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performReadonlyTransformation
/**
* Makes a pretty readonly field with some stars in it
*/
function performReadonlyTransformation()
{
$stars = '*****';
$field = new ReadonlyField($this->name, $this->title ? $this->title : '', $stars);
$field->setForm($this->form);
return $field;
}
示例2: Field
public function Field($properties = array())
{
$titleArray = $itemIDs = array();
$titleList = $itemIDsList = "";
if ($items = $this->getItems()) {
foreach ($items as $item) {
$titleArray[] = $item->Title;
}
foreach ($items as $item) {
$itemIDs[] = $item->ID;
}
if ($titleArray) {
$titleList = implode(", ", $titleArray);
}
if ($itemIDs) {
$itemIDsList = implode(",", $itemIDs);
}
}
$field = new ReadonlyField($this->name . '_ReadonlyValue', $this->title);
$field->setValue($titleList);
$field->setForm($this->form);
$valueField = new HiddenField($this->name);
$valueField->setValue($itemIDsList);
$valueField->setForm($this->form);
return $field->Field() . $valueField->Field();
}
示例3: performReadonlyTransformation
/**
* Returns a readonly version of this field
*/
function performReadonlyTransformation()
{
$field = new ReadonlyField($this->name, $this->title, $this->value);
$field->addExtraClass($this->extraClass());
$field->setForm($this->form);
return $field;
}
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-dynamiclists,代码行数:10,代码来源:DependentDynamicListDropdownField.php
示例4: performReadonlyTransformation
/**
* Transforms the source data for this CheckboxSetField
* into a comma separated list of values.
*
* @return ReadonlyField
*/
public function performReadonlyTransformation()
{
$values = '';
$data = array();
$items = $this->value;
if ($this->source) {
foreach ($this->source as $source) {
if (is_object($source)) {
$sourceTitles[$source->ID] = $source->Title;
}
}
}
if ($items) {
// Items is a DO Set
if (is_a($items, 'DataObjectSet')) {
foreach ($items as $item) {
$data[] = $item->Title;
}
if ($data) {
$values = implode(', ', $data);
}
// Items is an array or single piece of string (including comma seperated string)
} else {
if (!is_array($items)) {
$items = preg_split('/ *, */', trim($items));
}
foreach ($items as $item) {
if (is_array($item)) {
$data[] = $item['Title'];
} elseif (is_array($this->source) && !empty($this->source[$item])) {
$data[] = $this->source[$item];
} elseif (is_a($this->source, 'DataObjectSet')) {
$data[] = $sourceTitles[$item];
} else {
$data[] = $item;
}
}
$values = implode(', ', $data);
}
}
$title = $this->title ? $this->title : '';
$field = new ReadonlyField($this->name, $title, $values);
$field->setForm($this->form);
return $field;
}
示例5: performReadonlyTransformation
/**
* Makes a pretty readonly field with some stars in it
*/
public function performReadonlyTransformation()
{
$stars = '*****';
$field = new ReadonlyField($this->name, $this->title ? $this->title : _t('Member.PASSWORD'), $stars);
$field->setForm($this->form);
return $field;
}
示例6: performReadonlyTransformation
/**
* Makes a pretty readonly field
*/
function performReadonlyTransformation()
{
$values = '';
$items = $this->value;
foreach ($this->source as $source) {
if (is_object($source)) {
$sourceTitles[$source->ID] = $source->Title;
}
}
if ($items) {
// Items is a DO Set
if (is_a($items, 'DataObjectSet')) {
foreach ($items as $item) {
$data[] = $item->Title;
}
if ($data) {
$values = implode(", ", $data);
}
// Items is an array or single piece of string (including comma seperated string)
} else {
if (!is_array($items)) {
$items = split(" *, *", trim($items));
}
foreach ($items as $item) {
if (is_array($item)) {
$data[] = $item['Title'];
} else {
if (is_array($this->source) && $this->source[$item]) {
$data[] = $this->source[$item];
} else {
if (is_a($this->source, "ComponentSet")) {
//added for editable checkboxset.
$data[] = $sourceTitles[$item];
} else {
$data[] = $item;
}
}
}
}
$values = implode(", ", $data);
}
}
$field = new ReadonlyField($this->name, $this->title ? $this->title : "", $values);
$field->setForm($this->form);
return $field;
}
示例7: Field
function Field()
{
$titleArray = array();
$titleList = array();
if ($items = $this->getItems()) {
foreach ($items as $item) {
$titleArray[] = $item->Title;
}
if ($titleArray) {
$titleList = implode(", ", $titleArray);
}
}
$field = new ReadonlyField($this->name, $this->title);
$field->setValue($titleList);
$field->setForm($this->form);
return $field->Field();
}
示例8: performReadonlyTransformation
/**
* Return list of IDs for read only
*
* @return ReadonlyField
*/
public function performReadonlyTransformation()
{
$values = implode(',', $this->getSelected());
$field = new ReadonlyField($this->name, $this->title, $values);
$field->setForm($this->form);
return $field;
}