本文整理汇总了PHP中CompositeField::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP CompositeField::__construct方法的具体用法?PHP CompositeField::__construct怎么用?PHP CompositeField::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompositeField
的用法示例。
在下文中一共展示了CompositeField::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $name
* @param string $title
* @param array|FieldList $children
*/
public function __construct($name, $title, $children = null)
{
$this->name = $name;
$this->title = $title;
$this->children = $children ? $children : new FieldList();
parent::__construct($children);
}
示例2: __construct
/**
* @param string $name Identifier
* @param string $title (Optional) Natural language title of the tabset
* @param Tab|TabSet $unknown All further parameters are inserted as children into the TabSet
*/
public function __construct($name)
{
$args = func_get_args();
$name = array_shift($args);
if (!is_string($name)) {
user_error('TabSet::__construct(): $name parameter to a valid string', E_USER_ERROR);
}
$this->name = $name;
$this->id = $name;
// Legacy handling: only assume second parameter as title if its a string,
// otherwise it might be a formfield instance
if (isset($args[0]) && is_string($args[0])) {
$title = array_shift($args);
}
$this->title = isset($title) ? $title : FormField::name_to_label($name);
if ($args) {
foreach ($args as $tab) {
$isValidArg = is_object($tab) && (!$tab instanceof Tab || !$tab instanceof TabSet);
if (!$isValidArg) {
user_error('TabSet::__construct(): Parameter not a valid Tab instance', E_USER_ERROR);
}
$tab->setTabSet($this);
}
}
parent::__construct($args);
}
示例3: __construct
/**
* Constructor
*
* @param string $name Name
* @param string $title Title
* @param FieldList $fields CMS fields
* @param mixed $children Children
*
* @return void
*/
public function __construct($name, $title = '', $fields = null, $children = array())
{
parent::__construct($children);
$this->setName($name);
$this->setTitle($title);
$this->setFields($fields);
}
示例4: __construct
/**
* @param string $name Identifier
* @param string|Tab|TabSet $titleOrTab Natural language title of the tabset, or first tab.
* If its left out, the class uses {@link FormField::name_to_label()} to produce a title
* from the {@link $name} parameter.
* @param Tab|TabSet ...$tabs All further parameters are inserted as children into the TabSet
*/
public function __construct($name, $titleOrTab = null, $tabs = null)
{
if (!is_string($name)) {
throw new InvalidArgumentException('Invalid string parameter for $name');
}
// Get following arguments
$tabs = func_get_args();
array_shift($tabs);
// Detect title from second argument, if it is a string
if ($titleOrTab && is_string($titleOrTab)) {
$title = $titleOrTab;
array_shift($tabs);
} else {
$title = static::name_to_label($name);
}
// Normalise children list
if (count($tabs) === 1 && (is_array($tabs[0]) || $tabs[0] instanceof FieldList)) {
$tabs = $tabs[0];
}
// Ensure tabs are assigned to this tabset
if ($tabs) {
foreach ($tabs as $tab) {
if ($tab instanceof Tab || $tab instanceof TabSet) {
$tab->setTabSet($this);
} else {
throw new InvalidArgumentException("TabSet can only contain instances of other Tab or Tabsets");
}
}
}
parent::__construct($tabs);
// Assign name and title (not assigned by parent constructor)
$this->setName($name);
$this->setTitle($title);
$this->setID(Convert::raw2htmlid($name));
}
示例5:
/**
* Create a new selection group.
* @param name The field name of the selection group.
* @param items The list of items to show. This should be a map. The keys will be the radio
* button option names, and the values should be the associated field to display. If you want,
* you can make this field a composite field.
*
* If you want to a have a title that is different from the value of the key, you can express it
* as "InternalVal//This is the Title"
*/
function __construct($name, $items) {
$this->name = $name;
parent::__construct($items);
Requirements::css(FRAMEWORK_DIR . '/css/SelectionGroup.css');
}
示例6:
function __construct($name, $title, $children)
{
$this->name = $name;
$this->title = $title;
$this->startClosed(true);
parent::__construct($children);
}
示例7: __construct
public function __construct($title)
{
$args = func_get_args();
$this->title = array_shift($args);
$this->id = ereg_replace('[^0-9A-Za-z]+', '', $this->title);
parent::__construct($args);
}
示例8: __construct
public function __construct($name, $title = null, $value = null)
{
$this->labelField = LabelField::create($name . "Label", self::name_to_label($name))->addExtraClass("left");
$this->checkboxField = CheckboxField::create($name, "", $value);
$this->labelField->setTemplate("LabeledCheckboxLabelField");
$this->addExtraClass("field");
parent::__construct(array($this->labelField, $this->checkboxField));
}
示例9: __construct
public function __construct($name, $children = null)
{
$this->setName($name);
if (!$children) {
$children = array();
}
parent::__construct($children);
}
示例10: array
/**
* @param String $value Form field identifier
* @param FormField|array $fields Contents of the option
* @param String $title Title to show for the radio button option
*/
function __construct($value, $fields = null, $title = null)
{
$this->setValue($value);
if ($fields && !is_array($fields)) {
$fields = array($fields);
}
parent::__construct($fields);
$this->setTitle($title ?: $value);
}
示例11: __construct
public function __construct($name, $inlineForm, $actionToExecuteOnSaveInto = null)
{
$this->name = $name;
$this->inlineForm = $inlineForm;
$this->actionToExecuteOnSaveInto = $actionToExecuteOnSaveInto;
$this->inlineForm->setName($name);
$this->inlineForm->disableSecurityToken();
parent::__construct($inlineForm->Fields());
}
示例12: __construct
public function __construct($name, $title = null, $value = null)
{
$this->name = $name;
$this->setTitle($title);
parent::__construct(array($this->from = new DateSelectorField($this->name, $title, null, 'From'), $this->to = new DateSelectorField($this->name, $title, null, 'To')));
$this->from->addExtraClass('rangeselectedfrom');
$this->to->addExtraClass('rangeselectedto');
$this->setValue($value);
}
开发者ID:helpfulrobot,项目名称:dnadesign-silverstripe-datedropdownselectorfield,代码行数:9,代码来源:DateRangeSelectorField.php
示例13: __construct
/**
* Builds the button
* @param string $title The text for the button
* @param array $children Child buttons (FormActions)
*/
public function __construct($title = null, $children = array())
{
$this->Title = $title;
foreach ($children as $c) {
$c->setUseButtonTag(true);
}
parent::__construct($children);
self::$instance_count++;
$this->identifier = self::$instance_count;
}
示例14: __construct
public function __construct($id)
{
$tabs = func_get_args();
$this->id = array_shift($tabs);
$this->title = $this->id;
foreach ($tabs as $tab) {
$tab->setTabSet($this);
}
parent::__construct($tabs);
}
示例15: CheckboxField
function __construct($checkName, $childField, $value = "", $readonly = false)
{
$this->name = $checkName;
$this->checkbox = new CheckboxField($checkName, "", $value);
if ($readonly) {
$this->checkbox->setDisabled(true);
}
$this->childField = $childField;
$children = new FieldList($this->childField, $this->checkbox);
parent::__construct($children);
}