本文整理汇总了PHP中ReadonlyField::Field方法的典型用法代码示例。如果您正苦于以下问题:PHP ReadonlyField::Field方法的具体用法?PHP ReadonlyField::Field怎么用?PHP ReadonlyField::Field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadonlyField
的用法示例。
在下文中一共展示了ReadonlyField::Field方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: Field
public function Field($properties = array())
{
$content = '';
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . "/javascript/ToggleField.js");
if ($this->startClosed) {
$this->addExtraClass('startClosed');
}
$valforInput = $this->value ? Convert::raw2att($this->value) : "";
$rawInput = Convert::html2raw($valforInput);
if ($this->charNum) {
$reducedVal = substr($rawInput, 0, $this->charNum);
} else {
$reducedVal = DBField::create_field('Text', $rawInput)->{$this->truncateMethod}();
}
// only create togglefield if the truncated content is shorter
if (strlen($reducedVal) < strlen($rawInput)) {
$content = <<<HTML
\t\t\t<div class="readonly typography contentLess" style="display: none">
\t\t\t\t{$reducedVal}
\t\t\t\t <a href="#" class="triggerMore">{$this->labelMore}</a>
\t\t\t</div>
\t\t\t<div class="readonly typography contentMore">
\t\t\t\t{$this->value}
\t\t\t\t <a href="#" class="triggerLess">{$this->labelLess}</a>
\t\t\t</div>\t
\t\t\t<br />
\t\t\t<input type="hidden" name="{$this->name}" value="{$valforInput}" />
HTML;
} else {
$this->dontEscape = true;
$content = parent::Field();
}
return $content;
}
示例3: 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();
}