本文整理匯總了PHP中CompositeField::FieldSet方法的典型用法代碼示例。如果您正苦於以下問題:PHP CompositeField::FieldSet方法的具體用法?PHP CompositeField::FieldSet怎麽用?PHP CompositeField::FieldSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CompositeField
的用法示例。
在下文中一共展示了CompositeField::FieldSet方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: FieldSet
function FieldSet()
{
$items = parent::FieldSet()->toArray();
$count = 0;
$firstSelected = $checked = "";
foreach ($items as $key => $item) {
if (strpos($key, '//') !== false) {
list($key, $title) = explode('//', $key, 2);
} else {
$title = $key;
}
if ($this->value == $key) {
$firstSelected = " class=\"selected\"";
$checked = " checked=\"checked\"";
}
$itemID = $this->ID() . '_' . ++$count;
$extra = array("RadioButton" => "<input class=\"selector\" type=\"radio\" id=\"{$itemID}\" name=\"{$this->name}\" value=\"{$key}\"{$checked} />", "RadioLabel" => "<label for=\"{$itemID}\">{$title}</label>", "Selected" => $firstSelected);
if (is_object($item)) {
$newItems[] = $item->customise($extra);
} else {
$newItems[] = new ArrayData($extra);
}
$firstSelected = $checked = "";
}
return new DataObjectSet($newItems);
}