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


PHP NumericField::Field方法代码示例

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


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

示例1: testNumberTypeOnInputHtml

 public function testNumberTypeOnInputHtml()
 {
     $field = new NumericField('Number');
     $html = $field->Field();
     $this->assertContains('type="number"', $html, 'number type set');
     $this->assertContains('step="any"', $html, 'step value set to any');
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:7,代码来源:NumericFieldTest.php

示例2: Field

 public function Field()
 {
     $valArr = $this->value ? explode('-', $this->value) : null;
     // fields
     $first = new NumericField($this->name . '[first]', false, $valArr ? array_shift($valArr) : null);
     $first->setMaxLength(3);
     $first->addExtraClass('ird-numeric');
     $second = new NumericField($this->name . '[second]', false, $valArr ? array_shift($valArr) : null);
     $second->setMaxLength(3);
     $second->addExtraClass('ird-numeric');
     $third = new NumericField($this->name . '[third]', false, $valArr ? array_shift($valArr) : null);
     $third->setMaxLength(3);
     $third->addExtraClass('ird-numeric');
     $fields = array($first->Field(), $second->Field(), $third->Field());
     $html = implode('<span style="padding: 0 8px">-</span>', $fields);
     return $html;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-formfields-nz,代码行数:17,代码来源:IrdNumberField.php

示例3: Field

 function Field()
 {
     // Three separate fields for day, month and year
     if ($this->getConfig('dmyfields')) {
         // values
         $valArr = $this->valueObj ? $this->valueObj->toArray() : null;
         // fields
         $fieldDay = new NumericField($this->name . '[day]', false, $valArr ? $valArr['day'] : null);
         $fieldDay->addExtraClass('day');
         $fieldDay->setMaxLength(2);
         $fieldMonth = new NumericField($this->name . '[month]', false, $valArr ? $valArr['month'] : null);
         $fieldMonth->addExtraClass('month');
         $fieldMonth->setMaxLength(2);
         $fieldYear = new NumericField($this->name . '[year]', false, $valArr ? $valArr['year'] : null);
         $fieldYear->addExtraClass('year');
         $fieldYear->setMaxLength(4);
         // order fields depending on format
         $sep = $this->getConfig('dmyseparator');
         $format = $this->getConfig('dateformat');
         $fields = array();
         $fields[stripos($format, 'd')] = $fieldDay->Field();
         $fields[stripos($format, 'm')] = $fieldMonth->Field();
         $fields[stripos($format, 'y')] = $fieldYear->Field();
         ksort($fields);
         $html = implode($sep, $fields);
     } else {
         $html = parent::Field();
     }
     return $html;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:30,代码来源:DateField.php

示例4: Field

 public function Field($properties = array())
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(basename(dirname(dirname(__FILE__))) . '/javascript/SliderField.js');
     Requirements::css(basename(dirname(dirname(__FILE__))) . '/css/SliderField.css');
     return parent::Field($properties);
 }
开发者ID:helpfulrobot,项目名称:tractorcow-silverstripe-sliderfield,代码行数:9,代码来源:SliderField.php

示例5: testNumberTypeOnInputHtml

 public function testNumberTypeOnInputHtml()
 {
     $field = new NumericField('Number');
     $html = $field->Field();
     // @todo - Revert to number one day when html5 number supports proper localisation
     // See https://github.com/silverstripe/silverstripe-framework/pull/4565
     $this->assertContains('type="text"', $html, 'number type not set');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:8,代码来源:NumericFieldTest.php

示例6: Field

 function Field($properties = array())
 {
     $config = array('showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), 'jqueryDateformat' => DateField_View_JQuery::convert_iso_to_jquery_format($this->getConfig('dateformat')), 'min' => $this->getConfig('min'), 'max' => $this->getConfig('max'));
     // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.)
     // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField
     foreach ($this->getConfig() as $k => $v) {
         if (preg_match('/^jQueryUI\\.(.*)/', $k, $matches)) {
             $config[$matches[1]] = $v;
         }
     }
     $config = array_filter($config);
     foreach ($config as $k => $v) {
         $this->setAttribute('data-' . $k, $v);
     }
     // Three separate fields for day, month and year
     if ($this->getConfig('dmyfields')) {
         // values
         $valArr = $this->valueObj ? $this->valueObj->toArray() : null;
         // fields
         $fieldDay = new NumericField($this->name . '[day]', false, $valArr ? $valArr['day'] : null);
         $fieldDay->addExtraClass('day');
         $fieldDay->setMaxLength(2);
         $fieldMonth = new NumericField($this->name . '[month]', false, $valArr ? $valArr['month'] : null);
         $fieldMonth->addExtraClass('month');
         $fieldMonth->setMaxLength(2);
         $fieldYear = new NumericField($this->name . '[year]', false, $valArr ? $valArr['year'] : null);
         $fieldYear->addExtraClass('year');
         $fieldYear->setMaxLength(4);
         // order fields depending on format
         $sep = $this->getConfig('dmyseparator');
         $format = $this->getConfig('dateformat');
         $fields = array();
         $fields[stripos($format, 'd')] = $fieldDay->Field();
         $fields[stripos($format, 'm')] = $fieldMonth->Field();
         $fields[stripos($format, 'y')] = $fieldYear->Field();
         ksort($fields);
         $html = implode($sep, $fields);
         // dmyfields doesn't work with showcalendar
         $this->setConfig('showcalendar', false);
     } else {
         $html = parent::Field();
     }
     return $html;
 }
开发者ID:nzjoel,项目名称:sapphire,代码行数:44,代码来源:DateField.php


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