當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CompositeField::__construct方法代碼示例

本文整理匯總了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);
 }
開發者ID:silbinarywolf,項目名稱:multirecordfield,代碼行數:12,代碼來源:MultiRecordSubRecordField.php

示例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);
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:31,代碼來源:TabSet.php

示例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);
 }
開發者ID:silvercart,項目名稱:silvercart,代碼行數:17,代碼來源:SilvercartFieldGroup.php

示例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));
 }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:42,代碼來源:TabSet.php

示例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');
	}
開發者ID:redema,項目名稱:sapphire,代碼行數:17,代碼來源:SelectionGroup.php

示例6:

 function __construct($name, $title, $children)
 {
     $this->name = $name;
     $this->title = $title;
     $this->startClosed(true);
     parent::__construct($children);
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:7,代碼來源:ToggleCompositeField.php

示例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);
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:7,代碼來源:Tab.php

示例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));
 }
開發者ID:helpfulrobot,項目名稱:gdmedia-silverstripe-gdm-extensions,代碼行數:8,代碼來源:LabeledCheckboxField.php

示例9: __construct

 public function __construct($name, $children = null)
 {
     $this->setName($name);
     if (!$children) {
         $children = array();
     }
     parent::__construct($children);
 }
開發者ID:milkyway-multimedia,項目名稱:ss-mwm-formfields,代碼行數:8,代碼來源:ComponentFieldHolder_Item.php

示例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);
 }
開發者ID:SpiritLevel,項目名稱:silverstripe-framework,代碼行數:14,代碼來源:SelectionGroup_Item.php

示例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());
 }
開發者ID:milkyway-multimedia,項目名稱:ss-mwm-formfields,代碼行數:9,代碼來源:InlineFormField.php

示例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;
 }
開發者ID:dawidcieszynski,項目名稱:silverstripe-gridfield-betterbuttons,代碼行數:15,代碼來源:DropdownFormAction.php

示例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);
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:10,代碼來源:TabSet.php

示例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);
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-forum,代碼行數:11,代碼來源:CheckableOption.php


注:本文中的CompositeField::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。