當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FormBuilder::getForm方法代碼示例

本文整理匯總了PHP中Anomaly\Streams\Platform\Ui\Form\FormBuilder::getForm方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormBuilder::getForm方法的具體用法?PHP FormBuilder::getForm怎麽用?PHP FormBuilder::getForm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Anomaly\Streams\Platform\Ui\Form\FormBuilder的用法示例。


在下文中一共展示了FormBuilder::getForm方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * Handle the form.
  */
 public function handle()
 {
     $form = $this->builder->getForm();
     $model = $this->builder->getModel();
     /**
      * If the model is already instantiated
      * then use it as is.
      */
     if (is_object($model)) {
         $form->setModel($model);
         return;
     }
     /**
      * If no model is set, try guessing the
      * model based on best practices.
      */
     if ($model === null) {
         $parts = explode('\\', str_replace('FormBuilder', 'Model', get_class($this->builder)));
         unset($parts[count($parts) - 2]);
         $model = implode('\\', $parts);
         $this->builder->setModel($model);
     }
     /**
      * If the model does not exist or
      * is disabled then skip it.
      */
     if (!$model || !class_exists($model)) {
         $this->builder->setModel(null);
         return;
     }
     /**
      * Set the model on the form!
      */
     $form->setModel(app($model));
 }
開發者ID:jacksun101,項目名稱:streams-platform,代碼行數:38,代碼來源:SetFormModel.php

示例2: handle

 /**
  * Handle the command.
  *
  * @param Container $container
  */
 public function handle(Container $container)
 {
     /*
      * Set the default options handler based
      * on the builder class. Defaulting to
      * no handler.
      */
     if (!$this->builder->getRepository()) {
         $model = $this->builder->getFormModel();
         $entry = $this->builder->getEntry();
         $form = $this->builder->getForm();
         $repository = str_replace('FormBuilder', 'FormRepository', get_class($this->builder));
         if (!$this->builder->getRepository() && class_exists($repository)) {
             $this->builder->setRepository($container->make($repository, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $model instanceof EntryModel) {
             $this->builder->setRepository($container->make(EntryFormRepository::class, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $model instanceof EloquentModel) {
             $this->builder->setRepository($container->make(EloquentFormRepository::class, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $entry instanceof EntryModel) {
             $this->builder->setRepository($container->make(EntryFormRepository::class, ['form' => $form, 'model' => $entry]));
         } elseif (!$this->builder->getRepository() && $entry instanceof EloquentModel) {
             $this->builder->setRepository($container->make(EloquentFormRepository::class, ['form' => $form, 'model' => $entry]));
         }
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:30,代碼來源:SetRepository.php

示例3: handle

 /**
  * Handle the event.
  */
 public function handle()
 {
     $form = $this->builder->getForm();
     /* @var FieldType $field */
     foreach ($form->getEnabledFields() as $field) {
         $form->setValue($field->getInputName(), $field->getInputValue());
     }
 }
開發者ID:jacksun101,項目名稱:streams-platform,代碼行數:11,代碼來源:LoadFormValues.php

示例4: handle

 /**
  * Handle the command.
  *
  * @param MessageBag $messages
  */
 public function handle(MessageBag $messages)
 {
     $form = $this->builder->getForm();
     $errors = $form->getErrors();
     if ($errors instanceof \Illuminate\Support\MessageBag) {
         $messages->error($errors->all());
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:13,代碼來源:AddErrorMessages.php

示例5: handle

 /**
  * Handle the command.
  */
 public function handle()
 {
     $form = $this->builder->getForm();
     $options = $form->getOptions();
     $data = $form->getData();
     $content = view($options->get('form_view'), $data->all());
     $form->setContent($content);
     $form->addData('content', $content);
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:12,代碼來源:MakeForm.php

示例6: handle

 /**
  * Handle the command.
  */
 public function handle()
 {
     if (!$this->builder->canSave()) {
         return;
     }
     $form = $this->builder->getForm();
     foreach ($this->builder->getSkips() as $fieldSlug) {
         $form->removeField($fieldSlug);
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:13,代碼來源:RemoveSkippedFields.php

示例7: handle

 public function handle()
 {
     $form = $this->builder->getForm();
     $model = $this->builder->getModel();
     if (is_string($model) && !class_exists($model)) {
         return;
     }
     if (is_string($model)) {
         $model = app($model);
     }
     if ($model instanceof EntryInterface) {
         $form->setStream($model->getStream());
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:14,代碼來源:SetFormStream.php

示例8: save

 /**
  * Save the form.
  *
  * @param FormBuilder $builder
  * @return bool|mixed
  */
 public function save(FormBuilder $builder)
 {
     $form = $builder->getForm();
     $namespace = $form->getEntry() . '::';
     /* @var FieldType $field */
     foreach ($form->getFields() as $field) {
         $this->preferences->set($namespace . $field->getField(), $form->getValue($field->getInputName()));
     }
 }
開發者ID:AkibaTech,項目名稱:preferences-module,代碼行數:15,代碼來源:PreferenceFormRepository.php

示例9: build

 /**
  * Build the actions.
  *
  * @param FormBuilder $builder
  */
 public function build(FormBuilder $builder)
 {
     $form = $builder->getForm();
     $this->input->read($builder);
     foreach ($builder->getActions() as $action) {
         if (array_get($action, 'enabled', true)) {
             $form->addAction($this->factory->make($action));
         }
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:15,代碼來源:ActionBuilder.php

示例10: handle

 /**
  * Handle the command.
  *
  * @param Container            $container
  * @param ViewTemplate         $template
  * @param BreadcrumbCollection $breadcrumbs
  */
 public function handle(Container $container, ViewTemplate $template, BreadcrumbCollection $breadcrumbs)
 {
     $form = $this->builder->getForm();
     if ($handler = $form->getOption('data')) {
         $container->call($handler, compact('form'));
     }
     if ($layout = $form->getOption('layout_view')) {
         $template->put('layout', $layout);
     }
     if ($title = $form->getOption('title')) {
         $template->put('title', $title);
     }
     // Move this to options so we can read it.
     $this->builder->setFormOption('read_only', $this->builder->isReadOnly());
     $form->addData('form', $form);
     if ($breadcrumb = $form->getOption('breadcrumb', 'streams::form.mode.' . $this->builder->getFormMode())) {
         $breadcrumbs->put($breadcrumb, '#');
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:26,代碼來源:LoadForm.php

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

示例12: save

 /**
  * Save the form.
  *
  * @param FormBuilder $builder
  * @return bool|mixed
  */
 public function save(FormBuilder $builder)
 {
     $form = $builder->getForm();
     $namespace = $form->getEntry() . '::';
     /* @var FieldType $field */
     foreach ($form->getFields() as $field) {
         $key = $namespace . $field->getField();
         $value = $form->getValue($field->getInputName());
         $this->settings->set($key, $value);
     }
 }
開發者ID:Wol,項目名稱:settings-module,代碼行數:17,代碼來源:SettingFormRepository.php

示例13: processSelfHandlingFields

 /**
  * Process fields that handle themselves.
  *
  * @param FormBuilder $builder
  */
 protected function processSelfHandlingFields(FormBuilder $builder)
 {
     $form = $builder->getForm();
     $entry = $form->getEntry();
     $fields = $form->getFields();
     $fields = $fields->selfHandling();
     /* @var FieldType $field */
     foreach ($fields as $field) {
         app()->call([$field->setEntry($entry), 'handle'], compact('builder'));
     }
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:16,代碼來源:EloquentFormRepository.php


注:本文中的Anomaly\Streams\Platform\Ui\Form\FormBuilder::getForm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。