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


PHP Tag::radioField方法代码示例

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


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

示例1: registryFunctions

 /**
  * Registers common function in Twig
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $di
  * @param array                      $userFunctions
  */
 protected function registryFunctions($view, DiInterface $di, $userFunctions = array())
 {
     $options = array('is_safe' => array('html'));
     $functions = array(new \Twig_SimpleFunction('content', function () use($view) {
         return $view->getContent();
     }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
         return $view->partial($partialPath);
     }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
         return \Phalcon\Tag::linkTo($parameters, $text);
     }, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
         return \Phalcon\Tag::textField($parameters);
     }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
         return \Phalcon\Tag::passwordField($parameters);
     }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
         return \Phalcon\Tag::hiddenField($parameters);
     }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
         return \Phalcon\Tag::fileField($parameters);
     }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
         return \Phalcon\Tag::checkField($parameters);
     }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
         return \Phalcon\Tag::radioField($parameters);
     }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
         return \Phalcon\Tag::submitButton($parameters);
     }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = array()) {
         return \Phalcon\Tag::selectStatic($parameters, $data);
     }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = array()) {
         return \Phalcon\Tag::select($parameters, $data);
     }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
         return \Phalcon\Tag::textArea($parameters);
     }, $options), new \Twig_SimpleFunction('form', function ($parameters = array()) {
         return \Phalcon\Tag::form($parameters);
     }, $options), new \Twig_SimpleFunction('endForm', function () {
         return \Phalcon\Tag::endForm();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::stylesheetLink($parameters, $local);
     }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::javascriptInclude($parameters, $local);
     }, $options), new \Twig_SimpleFunction('image', function ($parameters) {
         return \Phalcon\Tag::image($parameters);
     }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
         return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
     }, $options), new \Twig_SimpleFunction('getDocType', function () {
         return \Phalcon\Tag::getDocType();
     }, $options), new \Twig_SimpleFunction('getSecurityToken', function () use($di) {
         return $di->get("security")->getToken();
     }, $options), new \Twig_SimpleFunction('getSecurityTokenKey', function () use($di) {
         return $di->get("security")->getTokenKey();
     }, $options), new \Twig_SimpleFunction('url', function ($route) use($di) {
         return $di->get("url")->get($route);
     }, $options));
     if (!empty($userFunctions)) {
         $functions = array_merge($functions, $userFunctions);
     }
     foreach ($functions as $function) {
         $this->twig->addFunction($function);
     }
 }
开发者ID:lisong,项目名称:incubator,代码行数:66,代码来源:Twig.php

示例2: registryFunctions

 /**
  * Registers common function in Twig
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  */
 private function registryFunctions($view)
 {
     $options = array('is_safe' => array('html'));
     $functions = array(new \Twig_SimpleFunction('content', function () use($view) {
         return $view->getContent();
     }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
         return $view->partial($partialPath);
     }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
         return \Phalcon\Tag::linkTo($parameters, $text);
     }, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
         return \Phalcon\Tag::textField($parameters);
     }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
         return \Phalcon\Tag::passwordField($parameters);
     }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
         return \Phalcon\Tag::hiddenField($parameters);
     }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
         return \Phalcon\Tag::fileField($parameters);
     }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
         return \Phalcon\Tag::checkField($parameters);
     }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
         return \Phalcon\Tag::radioField($parameters);
     }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
         return \Phalcon\Tag::submitButton($parameters);
     }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = []) {
         return \Phalcon\Tag::selectStatic($parameters, $data);
     }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = []) {
         return \Phalcon\Tag::select($parameters, $data);
     }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
         return \Phalcon\Tag::textArea($parameters);
     }, $options), new \Twig_SimpleFunction('form', function ($parameters = []) {
         return \Phalcon\Tag::form($parameters);
     }, $options), new \Twig_SimpleFunction('endForm', function () {
         return \Phalcon\Tag::endForm();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::stylesheetLink($parameters, $local);
     }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::javascriptInclude($parameters, $local);
     }, $options), new \Twig_SimpleFunction('image', function ($parameters) {
         return \Phalcon\Tag::image($parameters);
     }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
         return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
     }, $options), new \Twig_SimpleFunction('getDocType', function () {
         return \Phalcon\Tag::getDocType();
     }, $options));
     foreach ($functions as $function) {
         $this->_twig->addFunction($function);
     }
 }
开发者ID:tashik,项目名称:phalcon_core,代码行数:57,代码来源:Twig.php

示例3: testIssue947

 public function testIssue947()
 {
     $di = new Phalcon\DI\FactoryDefault();
     \Phalcon\Tag::setDI($di);
     $html = \Phalcon\Tag::radioField(array('test', 'value' => 1, 'checked' => 'checked'));
     $pos = strpos($html, 'checked="checked"');
     $this->assertTrue($pos !== FALSE);
     $html = \Phalcon\Tag::radioField(array('test', 'value' => 0));
     $pos = strpos($html, 'checked="checked"');
     $this->assertTrue($pos === FALSE);
     \Phalcon\Tag::setDefault("test", "0");
     $html = \Phalcon\Tag::radioField(array('test', 'value' => 0));
     $pos = strpos($html, 'checked="checked"');
     $this->assertTrue($pos !== FALSE);
 }
开发者ID:aisuhua,项目名称:phalcon-php,代码行数:15,代码来源:TagTest.php

示例4: radioField

 public static function radioField($parameters)
 {
     return parent::radioField($parameters);
 }
开发者ID:mattvb91,项目名称:cphalcon,代码行数:4,代码来源:Tag.php

示例5: testRadioFieldDisplayToElementNotPresentXHTML

 /**
  * Tests radioField with displayTo
  *
  * @author Nikos Dimopoulos <nikos@phalconphp.com>
  * @since  2012-09-15
  */
 public function testRadioFieldDisplayToElementNotPresentXHTML()
 {
     \Phalcon\Tag::setDoctype(\Phalcon\Tag::XHTML10_STRICT);
     $options = array('some_field_name', 'class' => 'some_class', 'size' => '10');
     \Phalcon\Tag::displayTo('some_field', 'some_default_value');
     $expected = '<input type="radio" id="some_field_name" name="some_field_name" value="" class="some_class" size="10" />';
     $actual = \Phalcon\Tag::radioField($options);
     \Phalcon\Tag::displayTo('some_field', '');
     \Phalcon\Tag::setDoctype('');
     $this->assertEquals($expected, $actual, sprintf($this->message, 'XHTML radioField with displayTo'));
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:17,代码来源:UnitTest.php

示例6: builtInSingleChoose

 /**
  * Make a single select widget, if options < 5 it will be expanded into radios by default
  *
  * Required parameters:
  * 'id', 'options' (in array)
  * Optional parameters:
  * 'name', 'class', 'value' (selected value) or other html attributes
  * 'expand' (true or false, by default 'auto')
  * 'useEmpty', 'emptyText' (used in select mode)
  * 'prefix', 'suffix' (used to wrap radios in expanded mode)
  * 'labelOn' ('left' or 'right', by default 'right', used to identify radios in expanded mode)
  *
  * @param array $parameters
  * @return string
  */
 protected static function builtInSingleChoose(array $parameters)
 {
     static::checkRequiredParameters($parameters, ['id', 'options']);
     $options = (array) $parameters['options'];
     $parameters[0] = $id = $parameters['id'];
     $expand = isset($parameters['expand']) ? $parameters['expand'] : 'auto';
     unset($parameters['options'], $parameters['expand']);
     // Expand select into radio buttons
     if ($expand === true || $expand == 'auto' && count($options) < 5) {
         $html = [];
         $i = 0;
         $radioParams = $parameters;
         $labelOn = isset($radioParams['labelOn']) ? $radioParams['labelOn'] : 'right';
         $prefix = isset($radioParams['prefix']) ? $radioParams['prefix'] : '';
         $suffix = isset($radioParams['suffix']) ? $radioParams['suffix'] : '';
         unset($radioParams['expand'], $radioParams['labelOn'], $radioParams['prefix'], $radioParams['suffix']);
         unset($radioParams['options'], $radioParams['useEmpty'], $radioParams['emptyText']);
         $selected = isset($parameters['value']) ? (string) $parameters['value'] : '';
         foreach ($options as $value => $label) {
             $radioParams['id'] = $radioId = $id . '_' . $i;
             $radioParams['value'] = $value;
             if ((string) $value === $selected) {
                 $radioParams['checked'] = 'checked';
             } else {
                 $radioParams['checked'] = null;
             }
             $radio = Tag::radioField($radioParams);
             $labelElement = static::label(['for' => $radioId], $label);
             if ($labelOn == 'right') {
                 $radio .= PHP_EOL . $labelElement;
             } else {
                 $radio = $labelElement . PHP_EOL . $radio;
             }
             ++$i;
             $html[] = $prefix . $radio . $suffix;
         }
         return implode(PHP_EOL, $html);
     }
     return Tag::select($parameters, $options);
 }
开发者ID:phwoolcon,项目名称:phwoolcon,代码行数:55,代码来源:Widget.php


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