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


PHP FormBuilder::getActions方法代码示例

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


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

示例1: defaults

 /**
  * Default the form actions when none are defined.
  *
  * @param FormBuilder $builder
  */
 public function defaults(FormBuilder $builder)
 {
     if ($builder->getActions() === []) {
         if ($builder->getFormMode() == 'create') {
             $builder->setActions(['save', 'save_create']);
         } else {
             $builder->setActions(['update', 'save_exit']);
         }
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:ActionDefaults.php

示例2: normalize

 /**
  * Normalize action input.
  *
  * @param FormBuilder $builder
  */
 public function normalize(FormBuilder $builder)
 {
     $form = $builder->getForm();
     $actions = $builder->getActions();
     $prefix = $form->getOption('prefix');
     foreach ($actions as $slug => &$action) {
         $action = $this->process($prefix, $slug, $action);
     }
     $builder->setActions($actions);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:15,代码来源:ActionNormalizer.php

示例3: guess

 /**
  * Guess the action's enabled parameter.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $actions = $builder->getActions();
     $mode = $builder->getFormMode();
     foreach ($actions as &$action) {
         if (isset($action['enabled']) && is_bool($action['enabled'])) {
             return;
         }
         if (isset($action['enabled']) && is_string($action['enabled'])) {
             $action['enabled'] = $mode === $action['enabled'];
         }
     }
     $builder->setActions($actions);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:19,代码来源:EnabledGuesser.php

示例4: merge

 /**
  * Merge in registered properties.
  *
  * @param FormBuilder $builder
  */
 public function merge(FormBuilder $builder)
 {
     $actions = $builder->getActions();
     foreach ($actions as &$parameters) {
         $action = $original = array_pull($parameters, 'action');
         if ($action && ($action = $this->actions->get($action))) {
             $parameters = array_replace_recursive($action, array_except($parameters, 'action'));
         }
         $button = array_get($parameters, 'button', $original);
         if ($button && ($button = $this->buttons->get($button))) {
             $parameters = array_replace_recursive($button, array_except($parameters, 'button'));
         }
     }
     $builder->setActions($actions);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:20,代码来源:ActionLookup.php

示例5: guess

 /**
  * Guess the action's enabled parameter.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $actions = $builder->getActions();
     $mode = $builder->getFormMode();
     foreach ($actions as &$action) {
         if (!isset($action['enabled'])) {
             continue;
         }
         if (is_bool($action['enabled'])) {
             continue;
         }
         $action['enabled'] = $mode === $action['enabled'];
     }
     $builder->setActions($actions);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:20,代码来源:EnabledGuesser.php

示例6: 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

示例7: build

 /**
  * Build dropdown items.
  *
  * @param FormBuilder $builder
  */
 public function build(FormBuilder $builder)
 {
     $actions = $builder->getActions();
     foreach ($actions as $key => &$action) {
         if ($dropdown = array_get($action, 'parent')) {
             foreach ($actions as &$parent) {
                 if (array_get($parent, 'slug') == $dropdown) {
                     if (!isset($parent['dropdown'])) {
                         $parent['dropdown'] = [];
                     }
                     $parent['dropdown'][] = $action;
                 }
             }
         }
     }
     $builder->setActions($actions);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:22,代码来源:ActionDropdown.php

示例8: 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

示例9: predict

 /**
  * Predict if the save_and_edit_next action
  * should be included.
  *
  * @param FormBuilder $builder
  */
 public function predict(FormBuilder $builder)
 {
     if (array_filter(explode(',', $builder->getRequestValue('edit_next')))) {
         $builder->setActions(array_merge(['save_edit_next'], $builder->getActions()));
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:12,代码来源:SaveEditNextPredictor.php

示例10: parse

 /**
  * Parse the form buttons.
  *
  * @param FormBuilder $builder
  */
 public function parse(FormBuilder $builder)
 {
     $entry = $builder->getFormEntry();
     $builder->setActions($this->parser->parse($builder->getActions(), compact('entry')));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:10,代码来源:ActionParser.php

示例11: resolve

 /**
  * Resolve form actions.
  *
  * @param FormBuilder $builder
  */
 public function resolve(FormBuilder $builder)
 {
     $this->resolver->resolve($builder->getActions(), compact('builder'));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:9,代码来源:ActionResolver.php


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