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


PHP FormBuilder::getOption方法代码示例

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


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

示例1: handle

 /**
  * Handle the event.
  */
 public function handle(Store $session)
 {
     /* @var MessageBag $errors */
     if ($errors = $session->get($this->builder->getOption('prefix') . 'errors')) {
         $this->builder->setFormErrors($errors);
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:10,代码来源:LoadFormErrors.php

示例2: handle

 /**
  * Handle the command.
  *
  * @param  Decorator $decorator
  * @param  Parser    $parser
  * @return array
  */
 public function handle(Decorator $decorator, Parser $parser)
 {
     $data = [];
     $data['form'] = $this->builder->getFormPresenter();
     $data['fields'] = $decorator->decorate($this->builder->getFormFields());
     $data['subject'] = $parser->parse($this->builder->getOption('subject', 'Contact Request'), $this->builder->getFormValues()->all());
     return $data;
 }
开发者ID:anomalylabs,项目名称:contact-plugin,代码行数:15,代码来源:GetMessageData.php

示例3: get

 /**
  * Get the form.
  *
  * @return FormPresenter
  */
 public function get()
 {
     $this->fire('ready', ['criteria' => $this]);
     array_set($this->parameters, 'key', md5(json_encode($this->parameters)));
     array_set($this->parameters, 'options.url', array_get($this->parameters, 'options.url', $this->builder->getOption('url', 'form/handle/' . array_get($this->parameters, 'key'))));
     $this->cache->remember('form::' . array_get($this->parameters, 'key'), 30, function () {
         return $this->parameters;
     });
     $this->hydrator->hydrate($this->builder, $this->parameters);
     return (new Decorator())->decorate($this->builder->make()->getForm());
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:16,代码来源:FormCriteria.php

示例4: build

 /**
  * Build the builder.
  *
  * @return FormBuilder
  */
 public function build()
 {
     /*
      * Hide breadcrumbs by default.
      */
     array_set($this->parameters, 'options.breadcrumb', array_get($this->parameters, 'options.breadcrumb', false));
     /*
      * Cache and hash!
      */
     array_set($this->parameters, 'key', md5(json_encode($this->parameters)));
     /*
      * Set the forms URL after obtaining
      * our parameter hash for the form.
      */
     array_set($this->parameters, 'options.url', array_get($this->parameters, 'options.url', $this->builder->getOption('url', 'form/handle/' . array_get($this->parameters, 'key'))));
     $this->cache->remember('form::' . array_get($this->parameters, 'key'), 30, function () {
         return $this->parameters;
     });
     if (is_array(array_get($this->parameters, 'options'))) {
         foreach (array_pull($this->parameters, 'options') as $key => $value) {
             $this->builder->setOption($key, $value);
         }
     }
     return $this->hydrator->hydrate($this->builder, $this->parameters);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:30,代码来源:FormCriteria.php

示例5: guess

 /**
  * Guess some some form action parameters.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $actions = $builder->getActions();
     $section = $this->sections->active();
     reset($actions);
     $first = key($actions);
     foreach ($actions as $key => &$action) {
         // If we already have an HREF then skip it.
         if (isset($action['redirect'])) {
             continue;
         }
         if ($key == $first && ($redirect = $builder->getOption('redirect'))) {
             $action['redirect'] = $redirect;
             continue;
         }
         // Determine the HREF based on the action type.
         switch (array_get($action, 'action')) {
             case 'save':
             case 'submit':
             case 'save_exit':
                 $action['redirect'] = $section ? $section->getHref() : $this->request->fullUrl();
                 break;
             case 'update':
             case 'save_edit':
             case 'save_continue':
                 $action['redirect'] = function () use($section, $builder) {
                     if ($section && $builder->getFormMode() == 'create') {
                         return $section->getHref('edit/' . $builder->getContextualId());
                     }
                     return $this->request->fullUrl();
                 };
                 break;
             case 'save_edit_next':
                 $ids = array_filter(explode(',', $builder->getRequestValue('edit_next')));
                 if (!$ids) {
                     $action['redirect'] = $section ? $section->getHref() : $this->request->fullUrl();
                 } elseif (count($ids) == 1) {
                     $action['redirect'] = $section ? $section->getHref('edit/' . array_shift($ids)) : $this->request->fullUrl();
                 } else {
                     $action['redirect'] = $section ? $section->getHref('edit/' . array_shift($ids) . '?' . $builder->getOption('prefix') . 'edit_next=' . implode(',', $ids)) : $this->request->fullUrl();
                 }
                 break;
         }
     }
     $builder->setActions($actions);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:51,代码来源:RedirectGuesser.php

示例6: handle

 /**
  * Handle the command.
  *
  * @param SettingRepository $settings
  */
 public function handle(SettingRepository $settings, Parser $parser)
 {
     $input = $this->builder->getFormValues()->all();
     call_user_func_array([$this->message, 'to'], $parser->parse((array) $this->builder->getOption('to', $settings->get('streams::contact_email', env('CONTACT_EMAIL', env('ADMIN_EMAIL')))), $input));
     if ($cc = (array) $this->builder->getOption('cc', null)) {
         call_user_func_array([$this->message, 'cc'], $parser->parse($cc, $input));
     }
     if ($bcc = (array) $this->builder->getOption('bcc', null)) {
         call_user_func_array([$this->message, 'bcc'], $parser->parse($bcc, $input));
     }
     call_user_func_array([$this->message, 'from'], $parser->parse((array) $this->builder->getOption('from', $settings->get('streams::server_email', 'noreply@localhost.com')), $input));
     call_user_func_array([$this->message, 'subject'], (array) $parser->parse($this->builder->getOption('subject', 'Contact Request'), $input));
 }
开发者ID:anomalylabs,项目名称:contact-plugin,代码行数:18,代码来源:BuildMessage.php

示例7: guess

 /**
  * Guess some some form action parameters.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $actions = $builder->getActions();
     $section = $this->sections->active();
     reset($actions);
     $first = key($actions);
     foreach ($actions as $key => &$action) {
         /*
          * If we already have an
          * HREF then skip it.
          */
         if (isset($action['redirect'])) {
             continue;
         }
         /*
          * If this is the first action and the
          * form builder has a redirect option
          * then use it for the action redirect.
          */
         if ($key == $first && ($redirect = $builder->getOption('redirect'))) {
             $action['redirect'] = $redirect;
             continue;
         }
         /*
          * If we're not in admin then just assume we
          * need to head back to the form. No redirect
          * will redirect back in this case.
          */
         if ($this->request->segment(1) !== 'admin') {
             continue;
         }
         // Determine the HREF based on the action type.
         switch (array_get($action, 'action')) {
             case 'save':
             case 'submit':
             case 'save_exit':
                 $action['redirect'] = $section ? $section->getHref() : $this->request->fullUrl();
                 break;
             case 'save_create':
                 $action['redirect'] = $this->request->fullUrl();
                 break;
             case 'update':
             case 'save_edit':
             case 'save_continue':
                 $action['redirect'] = function () use($section, $builder) {
                     if ($section && $builder->getFormMode() == 'create') {
                         return $section->getHref('edit/' . $builder->getContextualId());
                     }
                     return $this->request->fullUrl();
                 };
                 break;
             case 'save_edit_next':
                 $ids = array_filter(explode(',', $builder->getRequestValue('edit_next')));
                 if (!$ids) {
                     $action['redirect'] = $section ? $section->getHref() : $this->request->fullUrl();
                 } elseif (count($ids) == 1) {
                     $action['redirect'] = $section ? $section->getHref('edit/' . array_shift($ids)) : $this->request->fullUrl();
                 } else {
                     $action['redirect'] = $section ? $section->getHref('edit/' . array_shift($ids) . '?' . $builder->getOption('prefix') . 'edit_next=' . implode(',', $ids)) : $this->request->fullUrl();
                 }
                 break;
         }
     }
     $builder->setActions($actions);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:70,代码来源:RedirectGuesser.php

示例8: handle

 /**
  * Handle the event.
  *
  * @param Store $session
  */
 public function handle(Store $session)
 {
     $session->flash($this->builder->getOption('prefix') . 'errors', $this->builder->getFormErrors());
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:9,代码来源:FlashFormErrors.php


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