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


PHP sfForm::setWidget方法代码示例

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


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

示例1: configureJCropWidgets

 /**
  * Takes a form and configures each image's widget.
  * 
  * This is one of only 2 methods the user needs to call manually (the other being configureJCropValidators)
  * Should be called from the form's configure() method
  * 
  * @param sfForm $form
  */
 public function configureJCropWidgets(sfForm $form, $formOptions = array())
 {
     foreach ($this->_options['images'] as $fieldName) {
         if (!($imageConfig = $this->getImageConfig($fieldName))) {
             continue;
         }
         $form->setWidget($fieldName, new sfWidgetFormInputFileInputImageJCroppable(array('invoker' => $this->getInvoker(), 'image_field' => $fieldName, 'image_ratio' => isset($imageConfig['ratio']) ? $imageConfig['ratio'] : false, 'with_delete' => true, 'file_src' => $this->getImageSrc($fieldName, 'editable'), 'template' => '%file%<br />%input%<br />%delete% %delete_label%', 'form' => $form)));
         foreach (array('x1', 'y1', 'x2', 'y2') as $suffix) {
             $form->setWidget($fieldName . '_' . $suffix, new sfWidgetFormInputHidden());
         }
     }
 }
开发者ID:retrofox,项目名称:Huemul,代码行数:20,代码来源:JCroppable.php

示例2: embedForm

 /**
  * Just to make sure every time a form is embedded, the 'remove' widgets
  * are added. They are needed in the deleting process
  */
 public function embedForm($name, sfForm $form, $decorator = null)
 {
     if ($form instanceof sfFormDoctrine) {
         $form->setWidget('remove', new sfWidgetFormInputHidden(array(), array('class' => 'remove')));
         $form->setValidator('remove', new sfValidatorPass());
     }
     parent::embedForm($name, $form, $decorator);
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:12,代码来源:FormsContainer.class.php

示例3: replaceWidgets

 public static function replaceWidgets(sfForm $form)
 {
     foreach ($form->getWidgetSchema()->getFields() as $name => $widget) {
         if ($widget instanceof sfWidgetFormDate) {
             $form->setWidget($name, self::getDateWidget());
         } elseif ($widget instanceof sfWidgetFormFilterDate) {
             $form->getWidget($name)->setOption("from_date", self::getDateWidget(array("use_own_help" => false)));
             $form->getWidget($name)->setOption("to_date", self::getDateWidget(array("use_own_help" => false)));
             $form->getWidget($name)->setOption("template", __("from %from_date% to %to_date%"));
         } elseif ($widget instanceof sfWidgetFormTextarea) {
             $form->getWidget($name)->setAttribute("rows", 15);
             $form->getWidget($name)->setAttribute("cols", 100);
         }
         if ($name == "attachment") {
             $form->setWidget($name, new sfWidgetFormInputFile());
         } elseif ($name == "created_by" || $name == "updated_by") {
             if ($form instanceof sfFormPropel) {
                 $form->setWidget($name, new sfWidgetFormInputHidden());
             }
         } elseif ($name == "password") {
             $form->setWidget($name, new sfWidgetFormInputPassword());
         }
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:24,代码来源:pmWidgetFactory.class.php

示例4: addImageField

 /**
  * Add a validated image upload field to a form.
  * 
  * @param sfForm $form        Form to modify
  * @param string $field_name  Name of the image upload field, default 'image'  
  */
 public static function addImageField($form, $field_name = 'image')
 {
     $form->setWidget($field_name, new sfWidgetFormInputFile());
     $form->setValidator($field_name, new sfValidatorImageFile(self::getValidatorOptions(), self::getValidatorMessages()));
 }
开发者ID:nixilla,项目名称:sfImagePoolPlugin,代码行数:11,代码来源:sfImagePoolUtil.class.php

示例5: sfForm

        </div>
      <?php 
    }
    ?>
    </div>

    <?php 
    if ($name == 'polyline') {
        ?>
      <!-- TODO The first two lines should be in action. -->
      <div class="add-stop-wrapper">
        <?php 
        $oneFieldForm = new sfForm();
        ?>
        <?php 
        $oneFieldForm->setWidget('nj_stop_id', new sfWidgetFormDoctrineChoice(array('model' => 'NjStop', 'add_empty' => false)));
        ?>
        <?php 
        $oneFieldForm->setWidget('nj_stop_lat_lng', new sfWidgetFormDoctrineChoice(array('model' => 'NjStop', 'method' => 'getLatitudeLongitude', 'add_empty' => false)));
        ?>
        <?php 
        echo $oneFieldForm['nj_stop_id']->render();
        ?>
        <div class="nj_stop_lat_lng_wrapper" style="display:none;">
          <?php 
        echo $oneFieldForm['nj_stop_lat_lng']->render();
        ?>
        </div>   
        <a href="#add-stop" title="Add Stop" class="btn-add-stop">Add Stop</a>
      </div>
      <div class="map_wrapper">
开发者ID:nvieirafelipe,项目名称:graviola-project,代码行数:31,代码来源:_form_field.php

示例6: changeThemeWidget

 /**
  * Change theme widget to be dropdown of themes
  *
  * @param sfForm $form 
  * @return void
  */
 public static function changeThemeWidget(sfForm $form)
 {
     $array = self::getThemeWidgetAndValidator();
     $form->setWidget('theme', $array['widget']);
     $form->setValidator('theme', $array['validator']);
 }
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:12,代码来源:sfSympalFormToolkit.class.php


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