public function __construct($children = array(), $addressFields = array(), $buttonText = null) { $id = spl_object_hash($this); self::$ctr++; if (self::$ctr == 2) { //asdfsda; } if (sizeof($children) < 2 || !$children[0] instanceof FormField || !$children[1] instanceof FormField) { user_error('LatLongField argument 1 must be an array containing at least two FormField ' . 'objects for Lat/Long values, respectively.', E_USER_ERROR); } parent::__construct($children); $this->addressFields = $addressFields; $this->buttonText = $buttonText ? $buttonText : _t('LatLongField.LOOKUP', 'Search'); $this->latField = $children[0]->getName(); $this->longField = $children[1]->getName(); if (sizeof($children) == 3) { $this->zoomField = $children[2]->getName(); } $name = ""; foreach ($children as $field) { $name .= $field->getName(); } // hide the lat long and zoom fields from the interface foreach ($this->FieldList() as $fieldToHide) { $fieldToHide->addExtraClass('hide'); } $this->name = $name; }
public function __construct($children = array(), $filteredField = "ParentID", $sourceClass = "SiteTree", $returnKey = "ID", $returnLabel = "Title") { parent::__construct($children); $this->filteredField = $filteredField; $this->returnKey = $returnKey; $this->returnLabel = $returnLabel; $this->sourceClass = $sourceClass; $name = ""; foreach ($this->children as $c) { if ($c instanceof DropdownField) { $name .= $c->Name(); } } $this->name = $name; }
public function __construct($arg1 = null, $arg2 = null) { if (is_array($arg1) || is_a($arg1, 'FieldSet')) { $fields = $arg1; } else { if (is_array($arg2) || is_a($arg2, 'FieldList')) { $this->title = $arg1; $fields = $arg2; } else { $fields = func_get_args(); if (!is_object(reset($fields))) { $this->title = array_shift($fields); } } } parent::__construct($fields); }
public function __construct(Image $image) { // Load necessary scripts and styles Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(FOCUSPOINT_DIR . '/javascript/FocusPointField.js'); Requirements::css(FOCUSPOINT_DIR . '/css/FocusPointField.css'); // Create the fields $fields = array(LiteralField::create('FocusPointGrid', $image->renderWith('FocusPointField')), TextField::create('FocusX'), TextField::create('FocusY')); $this->setName('FocusPoint'); $this->setTitle('Focus Point'); $this->addExtraClass('focuspoint-fieldgroup'); if (Director::isDev() && $this->config()->get('debug')) { $this->addExtraClass('debug'); } parent::__construct($fields); }
function __construct($arg1 = null, $arg2 = null) { if (is_array($arg1) || is_a($arg1, 'FieldSet')) { $fields = $arg1; } else { if (is_array($arg2) || is_a($arg2, 'FieldList')) { $this->title = $arg1; $fields = $arg2; } else { $fields = func_get_args(); if (!is_object(reset($fields))) { $this->title = array_shift($fields); } } } foreach ($fields as $key => $field) { if (is_string($field)) { $fields[$key] = new LiteralField($this->Name() . 'Literal' . $key, $field); } } parent::__construct($fields); }
public function __construct($arg1 = null, $arg2 = null) { if ($arg1 === null) { $arg1 = new TextField('StreetName', ''); $arg1->setAttribute('placeholder', _t('GeoMemberExtension.STREETNAME')); $arg1->setAttribute('style', 'width:300px'); } if ($arg2 === null) { $arg2 = new TextField('StreetNumber', ''); $arg2->setAttribute('placeholder', _t('GeoMemberExtension.STREETNUMBER')); $arg2->setAttribute('style', 'width:75px'); } $this->streetNameField = $arg1; $this->streetNumberField = $arg2; $lang = i18n::get_lang_from_locale(i18n::get_locale()); if ($lang == 'fr') { parent::__construct($arg2, $arg1); } else { parent::__construct($arg1, $arg2); } $this->setTitle(_t('GeoMemberExtension.ADDRESSHEADER', 'Address')); $this->setFieldHolderTemplate('AddressFieldHolder'); }
public function __construct($arg1 = null, $arg2 = null, $arg3 = null) { if (!is_numeric($arg1) || $arg1 < 1 || 12 < $arg1) { throw new Exception(sprintf('Invalid Column with on BootstrapFieldColumn: %s', $arg1)); } else { $this->column_width = (int) $arg1; } if (is_array($arg2) || is_a($arg2, 'FieldSet')) { $fields = $arg2; } else { if (is_array($arg3) || is_a($arg3, 'FieldList')) { $this->title = $arg2; $fields = $arg3; } else { $fields = func_get_args(); reset($fields); $this->column_width = (int) array_shift($fields); if (!is_object(reset($fields))) { $this->title = array_shift($fields); } } } parent::__construct($fields); }
public function __construct($name) { $this->name = $name; parent::__construct(); }
public function __construct($name, $title = null, $value = '', $extension = null, $areaCode = null, $countryCode = null) { $this->areaCode = $areaCode; $this->ext = $extension; $this->countryCode = $countryCode; // Build fields $fields = new FieldList(); if ($this->countryCode !== null) { $countryField = NumericField::create($name . '[Country]', false, $countryCode, 4)->addExtraClass('phonenumber-field__country'); $fields->push($countryField); } if ($this->areaCode !== null) { $areaField = NumericField::create($name . '[Area]', false, $areaCode, 4)->addExtraClass('phonenumber-field__area'); $fields->push($areaField); } $numberField = NumericField::create($name . '[Number]', false, null, 10)->addExtraClass('phonenumber-field__number'); $fields->push($numberField); if ($this->ext !== null) { $extensionField = NumericField::create($name . '[Extension]', false, $extension, 6)->addExtraClass('phonenumber-field__extension'); $fields->push($extensionField); } parent::__construct($title, $fields); $this->setName($name); if (isset($value)) { $this->setValue($value); } }
/** * Repeats the given field twice to verify the user's input * * @param FieldInterface $innerField */ public function __construct(FieldInterface $innerField, array $options = array()) { $this->prototype = $innerField; parent::__construct($innerField->getKey(), $options); }