当前位置: 首页>>代码示例>>PHP>>正文


PHP FieldList::merge方法代码示例

本文整理汇总了PHP中FieldList::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::merge方法的具体用法?PHP FieldList::merge怎么用?PHP FieldList::merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FieldList的用法示例。


在下文中一共展示了FieldList::merge方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCMSFields

 /**
  * Get the CMS view of the instance. This is used to display the log of
  * this workflow, and options to reassign if the workflow hasn't been
  * finished yet
  *
  * @return \FieldList
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     if (Permission::check('REASSIGN_ACTIVE_WORKFLOWS')) {
         if ($this->WorkflowStatus == 'Paused' || $this->WorkflowStatus == 'Active') {
             $cmsUsers = Member::mapInCMSGroups();
             $fields->push(new HiddenField('DirectUpdate', '', 1));
             $fields->push(new HeaderField('InstanceReassignHeader', _t('WorkflowInstance.REASSIGN_HEADER', 'Reassign workflow')));
             $fields->push(new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Users'), $cmsUsers));
             $fields->push(new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Groups'), 'Group'));
         }
     }
     if ($this->canEdit()) {
         $action = $this->CurrentAction();
         if ($action->exists()) {
             $actionFields = $this->getWorkflowFields();
             $fields->merge($actionFields);
             $transitions = $action->getValidTransitions();
             if ($transitions) {
                 $fields->replaceField('TransitionID', DropdownField::create("TransitionID", "Next action", $transitions->map()));
             }
         }
     }
     $items = WorkflowActionInstance::get()->filter(array('Finished' => 1, 'WorkflowID' => $this->ID));
     $grid = new GridField('Actions', _t('WorkflowInstance.ActionLogTitle', 'Log'), $items);
     $fields->push($grid);
     return $fields;
 }
开发者ID:Neumes,项目名称:advancedworkflow,代码行数:35,代码来源:WorkflowInstance.php

示例2: __construct

 public function __construct($controller, $name = "VariationForm")
 {
     parent::__construct($controller, $name);
     $product = $controller->data();
     $farray = array();
     $requiredfields = array();
     $attributes = $product->VariationAttributeTypes();
     foreach ($attributes as $attribute) {
         $farray[] = $attribute->getDropDownField("Choose {$attribute->Label} ...", $product->possibleValuesForAttributeType($attribute));
         $requiredfields[] = "ProductAttributes[{$attribute->ID}]";
     }
     $fields = new FieldList($farray);
     if (self::$include_json) {
         $vararray = array();
         if ($vars = $product->Variations()) {
             foreach ($vars as $var) {
                 $vararray[$var->ID] = $var->AttributeValues()->map('ID', 'ID');
             }
         }
         $fields->push(new HiddenField('VariationOptions', 'VariationOptions', json_encode($vararray)));
     }
     $fields->merge($this->Fields());
     $this->setFields($fields);
     $requiredfields[] = 'Quantity';
     $this->setValidator(new VariationFormValidator($requiredfields));
     $this->extend('updateVariationForm');
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:27,代码来源:VariationForm.php

示例3: getFields

 public function getFields()
 {
     $fields = new FieldList();
     foreach ($this->fieldgroups as $group) {
         if (method_exists($this, "get" . $group . "Fields")) {
             $fields->merge($this->{"get" . $group . "Fields"}());
         }
     }
     return $fields;
 }
开发者ID:ss23,项目名称:silverstripe-omnipay,代码行数:10,代码来源:GatewayFieldsFactory.php

示例4: getFormFields

 /**
  * Get combined form fields
  * @return FieldList namespaced fields
  */
 public function getFormFields()
 {
     $fields = new FieldList();
     foreach ($this->getComponents() as $component) {
         if ($cfields = $component->getFormFields($this->order)) {
             $fields->merge($cfields);
         } else {
             user_error("getFields on  " . get_class($component) . " must return a FieldList");
         }
     }
     return $fields;
 }
开发者ID:8secs,项目名称:cocina,代码行数:16,代码来源:CheckoutComponentConfig.php

示例5: factory

 public static function factory($controller, CheckfrontAPIPackageResponse $packageResponse, array $info, array $data)
 {
     list($packageID, $startDate, $endDate, $linkType, $userType, $paymentType) = $info;
     // now build the form
     $fields = new FieldList();
     // add a hidden accessKey field if set
     $accessKey = isset($data[CheckfrontForm::AccessKeyFieldName]) ? $data[CheckfrontForm::AccessKeyFieldName] : null;
     $fields->push(new HiddenField(CheckfrontForm::AccessKeyFieldName, '', $accessKey));
     if ($userType === CheckfrontModule::UserTypeOrganiser) {
         // if organiser then add hidden start and end date fields for the actual booking
         $fields->merge(array(new HiddenField(CheckfrontForm::StartDateFieldName, '', $startDate), new HiddenField(CheckfrontForm::EndDateFieldName, '', $endDate)));
     } else {
         // if not organiser then let user specify their start and end dates
         $fields->merge(array(CheckfrontForm::make_date_field(CheckfrontForm::StartDateFieldName, 'Start Date', $startDate, $startDate, $endDate), CheckfrontForm::make_date_field(CheckfrontForm::EndDateFieldName, 'End Date', $endDate, $startDate, $endDate)));
     }
     // add the package items to the field list which will make the form as fields
     /** @var CheckfrontModel $item */
     foreach ($packageResponse->getPackageItems() as $item) {
         if ($controller->shouldShowItem($item, $userType, $linkType)) {
             $fields->merge($item->fieldsForForm('form'));
         }
     }
     $fields->merge(new FieldList(array(new HiddenField(CheckfrontAccessKeyForm::AccessKeyFieldName, '', $accessKey))));
     $actions = new FieldList();
     $required = array();
     // add the standard 'booking' fields (name etc)
     if ($response = CheckfrontModule::api()->fetchBookingForm()) {
         if ($response->isValid()) {
             // now add the booking fields to the fieldlist for the form
             $bookingFields = $response->getFormFields($required);
             $fields->merge($bookingFields);
         }
         $actions->push(new FormAction(static::SubmitButtonName, _t(__CLASS__ . ".SubmitButtonText")));
     }
     $validator = new RequiredFields($required);
     $form = new CheckfrontPackageBookingForm($controller, static::FormName, $fields, $actions, $validator);
     return $form;
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-checkfront,代码行数:38,代码来源:PackageBooking.php

示例6: __construct

    /**
     * Create the mailchimp subscription 
     * 
     * @param Controller $controller
     * @param string $name
     */
    public function __construct($controller, $name, $extendedFields = null, $listCode = null)
    {
        $fields = new FieldList(TextField::create('Name', 'Name')->setAttribute('required', 'required')->setAttribute('placeholder', 'Enter your name'), EmailField::create('Email', 'Email')->setAttribute('required', 'required')->setAttribute('placeholder', 'Enter your email address'));
        if ($extendedFields) {
            $fields->merge($extendedFields);
        }
        $this->extend('updateFields', $fields);
        $formAction = FormAction::create('subscribe')->setTitle('Subscribe');
        $formAction->useButtonTag = true;
        $actions = new FieldList($formAction);
        $validator = new RequiredFields('Email');
        parent::__construct($controller, $name, $fields, $actions, $validator);
        Requirements::css('mailchimp/css/mailchimp.css');
        Requirements::javascript('mailchimp/javascript/jquery.mailchimp.js');
        Requirements::customScript(<<<JS
\t\t\t(function(\$) {
\t\t\t    \$(document).ready(function(){
\t\t\t        \$('form#newsletter').mailchimp();
\t\t\t    });
\t\t\t})(jQuery);\t\t\t
JS
);
    }
开发者ID:sentromedia,项目名称:letsfund,代码行数:29,代码来源:MailChimpForm.php

示例7: array

 /**
  *
  * @param Controller
  * @param String
  */
 function __construct(Controller $controller, $name)
 {
     //set basics
     $requiredFields = array();
     //requirements
     Requirements::javascript('ecommerce/javascript/EcomOrderFormAddress.js');
     // LEAVE HERE - NOT EASY TO INCLUDE VIA TEMPLATE
     if (EcommerceConfig::get("OrderAddress", "use_separate_shipping_address")) {
         Requirements::javascript('ecommerce/javascript/EcomOrderFormShipping.js');
         // LEAVE HERE - NOT EASY TO INCLUDE VIA TEMPLATE
     }
     //  ________________ 1) Order + Member + Address fields
     //find member
     $this->order = ShoppingCart::current_order();
     $this->orderMember = $this->order->CreateOrReturnExistingMember(false);
     $this->loggedInMember = Member::currentUser();
     //strange security situation...
     if ($this->orderMember->exists() && $this->loggedInMember) {
         if ($this->orderMember->ID != $this->loggedInMember->ID) {
             if (!$this->loggedInMember->IsShopAdmin()) {
                 $this->loggedInMember->logOut();
             }
         }
     }
     $addressFieldsBilling = new FieldList();
     //member fields
     if ($this->orderMember) {
         $memberFields = $this->orderMember->getEcommerceFields();
         $requiredFields = array_merge($requiredFields, $this->orderMember->getEcommerceRequiredFields());
         $addressFieldsBilling->merge($memberFields);
     }
     //billing address field
     $billingAddress = $this->order->CreateOrReturnExistingAddress("BillingAddress");
     $billingAddressFields = $billingAddress->getFields($this->orderMember);
     $requiredFields = array_merge($requiredFields, $billingAddress->getRequiredFields());
     $addressFieldsBilling->merge($billingAddressFields);
     //shipping address field
     $addressFieldsShipping = null;
     if (EcommerceConfig::get("OrderAddress", "use_separate_shipping_address")) {
         $addressFieldsShipping = new FieldList();
         //add the important CHECKBOX
         $useShippingAddressField = new FieldList(new CheckboxField("UseShippingAddress", _t("OrderForm.USESHIPPINGADDRESS", "Use an alternative shipping address")));
         $addressFieldsShipping->merge($useShippingAddressField);
         //now we can add the shipping fields
         $shippingAddress = $this->order->CreateOrReturnExistingAddress("ShippingAddress");
         $shippingAddressFields = $shippingAddress->getFields($this->orderMember);
         //we have left this out for now as it was giving a lot of grief...
         //$requiredFields = array_merge($requiredFields, $shippingAddress->getRequiredFields());
         //finalise left fields
         $addressFieldsShipping->merge($shippingAddressFields);
     }
     $leftFields = new CompositeField($addressFieldsBilling);
     $leftFields->addExtraClass('leftOrderBilling');
     $allLeftFields = new CompositeField($leftFields);
     $allLeftFields->addExtraClass('leftOrder');
     if ($addressFieldsShipping) {
         $leftFieldsShipping = new CompositeField($addressFieldsShipping);
         $leftFieldsShipping->addExtraClass('leftOrderShipping');
         $allLeftFields->push($leftFieldsShipping);
     }
     //  ________________  2) Log in / vs Create Account fields - RIGHT-HAND-SIDE fields
     $rightFields = new CompositeField();
     $rightFields->addExtraClass('rightOrder');
     //to do: simplify
     if (EcommerceConfig::get("EcommerceRole", "allow_customers_to_setup_accounts")) {
         if ($this->orderDoesNotHaveFullyOperationalMember()) {
             //general header
             if (!$this->loggedInMember) {
                 $rightFields->push(new LiteralField('MemberInfo', '<p class="message good">' . _t('OrderForm.MEMBERINFO', 'If you already have an account then please') . " <a href=\"Security/login/?BackURL=/" . urlencode(implode("/", $controller->getURLParams())) . "\">" . _t('OrderForm.LOGIN', 'log in') . '</a>.</p>'));
             }
         } else {
             if ($this->loggedInMember) {
                 $rightFields->push(new LiteralField('LoginNote', "<p class=\"message good\">" . _t("Account.LOGGEDIN", "You are logged in as ") . Convert::raw2xml($this->loggedInMember->FirstName) . ' ' . Convert::raw2xml($this->loggedInMember->Surname) . ' (' . Convert::raw2xml($this->loggedInMember->Email) . ').' . ' <a href="/Security/logout/">' . _t("Account.LOGOUTNOW", "Log out?") . '</a>' . '</p>'));
             }
         }
         if ($this->orderMember->exists()) {
             if ($this->loggedInMember) {
                 if ($this->loggedInMember->ID != $this->orderMember->ID) {
                     $rightFields->push(new LiteralField('OrderAddedTo', "<p class=\"message good\">" . _t("Account.ORDERADDEDTO", "Order will be added to ") . Convert::raw2xml($this->orderMember->FirstName) . ' ' . Convert::raw2xml($this->orderMember->Surname) . ' (' . Convert::raw2xml($this->orderMember->Email) . ').</p>'));
                 }
             }
         }
     }
     //  ________________  5) Put all the fields in one FieldList
     $fields = new FieldList($rightFields, $allLeftFields);
     //  ________________  6) Actions and required fields creation + Final Form construction
     $nextButton = new FormAction('saveAddress', _t('OrderForm.NEXT', 'Next'));
     $nextButton->addExtraClass("next");
     $actions = new FieldList($nextButton);
     $validator = OrderFormAddress_Validator::create($requiredFields);
     parent::__construct($controller, $name, $fields, $actions, $validator);
     $this->setAttribute("autocomplete", "off");
     //extensions need to be set after __construct
     //extension point
     $this->extend('updateFields', $fields);
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:101,代码来源:OrderFormAddress.php

示例8: Form

 function Form()
 {
     if (isset($_REQUEST["BackURL"])) {
         Session::set('BackURL', $_REQUEST["BackURL"]);
     }
     $member = Member::currentUser();
     $fields = new FieldList();
     $passwordField = null;
     if ($member) {
         $name = $member->getName();
         //if($member && $member->Password != '') {$passwordField->setCanBeEmpty(true);}
         $action = new FormAction("submit", "Update your details");
         $action->addExtraClass("updateButton");
         $actions = new FieldList($action);
     } else {
         $passwordField = new ConfirmedPasswordField("Password", "Password");
         $action = new FormAction("submit", "Register");
         $action->addExtraClass("registerButton");
         $actions = new FieldList($action);
         $member = new Member();
     }
     $memberFormFields = $member->getMemberFormFields();
     if ($memberFormFields) {
         if (is_array(self::$fields_to_remove) && count(self::$fields_to_remove)) {
             foreach (self::$fields_to_remove as $fieldName) {
                 $memberFormFields->removeByName($fieldName);
             }
         }
         $fields->merge($memberFormFields);
     }
     if ($passwordField) {
         $fields->push($passwordField);
     }
     foreach (self::$required_fields as $fieldName) {
         $fields->fieldByName($fieldName)->addExtraClass("RequiredField");
     }
     $requiredFields = new RequiredFields(self::$required_fields);
     $form = new Form($this, "Form", $fields, $actions, $requiredFields);
     // Load any data avaliable into the form.
     if ($member) {
         $member->Password = null;
         $form->loadDataFrom($member);
     }
     $data = Session::get("FormInfo.Form_Form.data");
     if (is_array($data)) {
         $form->loadDataFrom($data);
     }
     // Optional spam protection
     if (class_exists('SpamProtectorManager')) {
         SpamProtectorManager::update_form($form);
     }
     if (!isset($_REQUEST["Password"])) {
         $form->fields()->fieldByName("Password")->SetValue("");
     }
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-userpage,代码行数:56,代码来源:RegisterAndEditDetailsPage.php

示例9: updateFrontEndFields

 public function updateFrontEndFields(FieldList $fields)
 {
     if (!$fields->dataFieldByName("Address")) {
         $fields->merge($this->getAddressFields());
     }
 }
开发者ID:alexoconner,项目名称:silverstripe-addressable,代码行数:6,代码来源:Addressable.php

示例10: getPaymentFields

 /**
  * Primary method for generating the form fields used.
  * Includes an extension to allow custom extensions.
  *
  * @return FieldList
  */
 protected function getPaymentFields()
 {
     $fields = new FieldList();
     $fields->merge($this->getCreditCardFields());
     // Allow easy customisatin of the payment fields
     $this->extend('updatePaymentFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-omnipayable,代码行数:14,代码来源:OmnipayableForm.php

示例11: StartForm

 public function StartForm()
 {
     $databaseTemplates = $this->getDatabaseTemplates();
     $fields = new FieldList(new CheckboxField('createDatabase', 'Create temporary database?', 1));
     if ($databaseTemplates) {
         $fields->push($dropdown = new DropdownField('importDatabasePath', false));
         $dropdown->setSource($databaseTemplates)->setEmptyString('Empty database');
     }
     $fields->push(new CheckboxField('requireDefaultRecords', 'Create default data?'));
     if (Director::isDev()) {
         $fields->push(CheckboxField::create('globalTestSession', 'Use global test session?')->setDescription('Caution: Will apply to all users across browsers'));
     }
     $fields->merge($this->getBaseFields());
     $form = new Form($this, 'StartForm', $fields, new FieldList(new FormAction('start', 'Start Session')));
     $this->extend('updateStartForm', $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-testsession,代码行数:17,代码来源:TestSessionController.php

示例12: updateEditForm

 public function updateEditForm(FieldList $fields)
 {
     $fields->removeByName('StreakConfig');
     $fields->merge($this->getConfigFields());
 }
开发者ID:swipestreak,项目名称:swipestreak,代码行数:5,代码来源:Config.php


注:本文中的FieldList::merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。