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


PHP FormContainer::get方法代码示例

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


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

示例1: get

 /**
  * Produce HTML output for all this fieldset and all contained controls
  *
  * @param Theme $theme
  * @return string HTML that will render this control in the form
  */
 function get(Theme $theme)
 {
     $this->settings['ignore_name'] = true;
     $controls = array();
     foreach ($this->controls as $control) {
         if ($class = $this->get_setting('class_each', '')) {
             $control->add_class($class);
         }
         if ($control instanceof FormContainer) {
             $control->set_template($this->get_setting('tab_template', 'control.fieldset.fortabs'));
             $controls[$control->caption] = $control->get($theme);
         }
     }
     $this->vars['controls'] = $controls;
     return parent::get($theme);
 }
开发者ID:habari,项目名称:system,代码行数:22,代码来源:formcontroltabs.php

示例2: get

 /**
  * Produce HTML output for all this fieldset and all contained controls
  *
  * @param boolean $forvalidation True if this control should render error information based on validation.
  * @return string HTML that will render this control in the form
  */
 function get(Theme $theme)
 {
     $this->vars['label'] = $this->label;
     $this->properties['for'] = reset($this->controls)->get_visualizer();
     return parent::get($theme);
 }
开发者ID:habari,项目名称:system,代码行数:12,代码来源:formcontrollabel.php

示例3: get

 /**
  * Produce the HTML for this control
  * @param Theme $theme The theme used for rendering
  * @return string The rendered control in HTML
  */
 function get(Theme $theme)
 {
     $this->settings['ignore_name'] = true;
     $this->vars['caption'] = $this->caption;
     return parent::get($theme);
 }
开发者ID:habari,项目名称:system,代码行数:11,代码来源:formcontrolfieldset.php

示例4: get

 /**
  * Get this control for display
  * @param Theme $theme The theme to use for rendering
  * @return string The output
  */
 public function get(Theme $theme)
 {
     $this->vars['element'] = $this->get_setting('wrap_element', 'div');
     return parent::get($theme);
 }
开发者ID:habari,项目名称:system,代码行数:10,代码来源:formcontrolwrapper.php

示例5: get

 /**
  * Produce a form with the contained fields.
  *
  * @param Theme $theme The theme to render the controls into
  * @return string HTML form generated from all controls assigned to this form
  */
 public function get(Theme $theme = null)
 {
     // Allow plugins to modify the form
     Plugins::act('modify_form_' . Utils::slugify($this->formtype, '_'), $this);
     Plugins::act('modify_form', $this);
     // Get the theme used to render the form
     if (is_null($theme)) {
         $theme = $this->get_theme();
     }
     $theme->start_buffer();
     $theme->success = false;
     $this->success = false;
     $this->submitted = false;
     $this->success_render = false;
     // Set the ID of the control explicitly if it's not already set
     $this->get_id();
     // If the form template wasn't explicitly set, set it, because this class' name can't be used to determine its template
     if (!isset($this->settings['template'])) {
         $this->set_template('control.form');
     }
     // If the action of this form wasn't explicitly set, unset it to avoid validation errors in output
     if (empty($this->properties['action'])) {
         unset($this->properties['action']);
     }
     // Add the control ID to the template output for the form
     $this->vars['_control_id'] = $this->control_id();
     // Load all of the initial values of controls from their storage locations
     $this->load();
     // If there was an error submitting this form before, set the values of the controls to the old ones to retry
     $this->set_from_error_values();
     // Is this form not a same-page duplicate?
     if (!$this->get_setting('is_dupe', false)) {
         // Was the form submitted?
         if (isset($_POST['_form_id']) && $_POST['_form_id'] == $this->control_id()) {
             $this->submitted = true;
             // Process all of the submitted values into the controls
             $this->process();
             // Do any of the controls fail validation?  This call alters the wrap
             $validation_errors = $this->validate();
             if (count($validation_errors) == 0) {
                 // All of the controls validate
                 $this->success = true;
                 // If do_success() returns anything, it should be output instead of the form.
                 $this->success_render = $this->do_success($this);
             } else {
                 if (isset($this->settings['use_session_errors']) && $this->settings['use_session_errors']) {
                     $this->each(function ($control) {
                         $control->errors = array();
                     });
                     foreach ($validation_errors as $error) {
                         Session::error($error);
                     }
                 }
             }
         } else {
             // Store the location at which this form was loaded, so we can potentially redirect to it later
             if (!$this->has_session_data() || !isset($_SESSION['forms'][$this->control_id()]['url'])) {
                 $_SESSION['forms'][$this->control_id()]['url'] = Site::get_url('habari', true) . Controller::get_stub() . '#' . $this->get_id(false);
             }
         }
         $output = $this->pre_out_controls();
         if ($this->success_render) {
             $output .= $this->success_render;
         } else {
             $output .= parent::get($theme);
         }
         if ($this->success && isset($this->settings['success_message'])) {
             $output .= $this->settings['success_message'];
         }
     } else {
         $output = parent::get($theme);
     }
     if (class_exists('\\tidy')) {
         $t = new \tidy();
         $t->parseString($output, array('indent' => true, 'wrap' => 80, 'show-body-only' => true));
         //$output = (string) $t;
     }
     return $output;
 }
开发者ID:habari,项目名称:system,代码行数:85,代码来源:formui.php

示例6: get

 public function get(Theme $theme)
 {
     $primary = true;
     $controls = array();
     /** @var FormControlSubmit $control */
     foreach ($this->controls as $index => $control) {
         if ($control->is_enabled()) {
             $control->add_class('dropbutton_action');
             $control->add_class(Utils::slugify($control->input_name()));
             if ($primary) {
                 $control->add_class('primary');
                 $primary = false;
             }
             $controls[$index] = $control;
         }
     }
     if (count($controls) == 0) {
         return '';
     }
     $this->vars['first'] = array_shift($controls);
     $this->vars['actions'] = $controls;
     $this->set_template_properties('div', array('id' => $this->get_visualizer()));
     $this->add_template_class('ul', 'dropdown-menu');
     if (count($controls) > 0) {
         // Remember, these are in the dropmenu, doesn't include the first
         $this->add_template_class('div', 'has-drop');
     } else {
         $this->add_template_class('div', 'no-drop');
     }
     return parent::get($theme);
 }
开发者ID:habari,项目名称:system,代码行数:31,代码来源:formcontroldropbutton.php


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