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


PHP FormBuilder::setButtons方法代码示例

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


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

示例1: guess

 /**
  * Guess the HREF for a button.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $buttons = $builder->getButtons();
     $entry = $builder->getFormEntry();
     // Nothing to do if empty.
     if (!($section = $this->sections->active())) {
         return;
     }
     foreach ($buttons as &$button) {
         if (isset($button['attributes']['href'])) {
             continue;
         }
         switch (array_get($button, 'button')) {
             case 'cancel':
                 $button['attributes']['href'] = $section->getHref();
                 break;
             case 'delete':
                 $button['attributes']['href'] = $section->getHref('delete/' . $entry->getId());
                 break;
             default:
                 // Determine the HREF based on the button type.
                 $type = array_get($button, 'button');
                 if ($type && !str_contains($type, '\\') && !class_exists($type)) {
                     $button['attributes']['href'] = $section->getHref($type . '/{entry.id}');
                 }
                 break;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:35,代码来源:HrefGuesser.php

示例2: normalize

 /**
  * Normalize button input.
  *
  * @param FormBuilder $builder
  */
 public function normalize(FormBuilder $builder)
 {
     $buttons = $builder->getButtons();
     foreach ($buttons as $key => &$button) {
         $button = $this->process($key, $button);
     }
     $builder->setButtons($buttons);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:13,代码来源:ButtonNormalizer.php

示例3: merge

 /**
  * Merge in registered properties.
  *
  * @param FormBuilder $builder
  */
 public function merge(FormBuilder $builder)
 {
     $buttons = $builder->getButtons();
     foreach ($buttons as &$parameters) {
         if ($button = $this->buttons->get(array_get($parameters, 'button'))) {
             $parameters = array_replace_recursive($button, $parameters);
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:ButtonLookup.php

示例4: guess

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

示例5: guess

 /**
  * Guess the HREF for a button.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $buttons = $builder->getButtons();
     $mode = $builder->getFormMode();
     foreach ($buttons as &$button) {
         if (isset($button['enabled']) && is_bool($button['enabled'])) {
             return;
         }
         switch (array_get($button, 'button')) {
             case 'delete':
                 $button['enabled'] = $mode === 'edit';
                 break;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:21,代码来源:EnabledGuesser.php

示例6: build

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

示例7: defaults

 /**
  * Default the form buttons when none are defined.
  *
  * @param FormBuilder $builder
  */
 public function defaults(FormBuilder $builder)
 {
     if ($builder->getButtons() === []) {
         $builder->setButtons(['cancel']);
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:11,代码来源:ButtonDefaults.php

示例8: guess

 /**
  * Guess the button from the hint.
  *
  * @param FormBuilder $builder
  */
 public function guess(FormBuilder $builder)
 {
     $buttons = $builder->getButtons();
     $module = $this->modules->active();
     /*
      * This will break if we can't figure
      * out what the active module is.
      */
     if (!$module instanceof Module) {
         return;
     }
     foreach ($buttons as &$button) {
         if (isset($button['text'])) {
             continue;
         }
         if (!isset($button['button'])) {
             continue;
         }
         $text = $module->getNamespace('button.' . $button['button']);
         if (!isset($button['text']) && $this->translator->has($text)) {
             $button['text'] = $text;
         }
         if ((!isset($button['text']) || !$this->translator->has($button['text'])) && $this->config->get('streams::system.lazy_translations')) {
             $button['text'] = ucwords($this->string->humanize($button['button']));
         }
         if (!isset($button['text'])) {
             $button['text'] = $text;
         }
     }
     $builder->setButtons($buttons);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:36,代码来源:TextGuesser.php

示例9: evaluate

 /**
  * Evaluate the form buttons.
  *
  * @param FormBuilder $builder
  */
 public function evaluate(FormBuilder $builder)
 {
     $entry = $builder->getFormEntry();
     $builder->setButtons($this->evaluator->evaluate($builder->getButtons(), compact('builder', 'entry')));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:10,代码来源:ButtonEvaluator.php

示例10: parse

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


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