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


PHP ElementInterface::getMinuteElement方法代码示例

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


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

示例1: render

 /**
  * Render a date element that is composed of six selects
  *
  * @param  ElementInterface $element
  * @throws \Zend\Form\Exception\InvalidArgumentException
  * @throws \Zend\Form\Exception\DomainException
  * @return string
  */
 public function render(ElementInterface $element)
 {
     if (!$element instanceof DateTimeSelectElement) {
         throw new Exception\InvalidArgumentException(sprintf('%s requires that the element is of type Zend\\Form\\Element\\DateTimeSelect', __METHOD__));
     }
     $name = $element->getName();
     if ($name === null || $name === '') {
         throw new Exception\DomainException(sprintf('%s requires that the element has an assigned name; none discovered', __METHOD__));
     }
     $shouldRenderDelimiters = $element->shouldRenderDelimiters();
     $selectHelper = $this->getSelectElementHelper();
     $pattern = $this->parsePattern($shouldRenderDelimiters);
     $daysOptions = $this->getDaysOptions($pattern['day']);
     $monthsOptions = $this->getMonthsOptions($pattern['month']);
     $yearOptions = $this->getYearsOptions($element->getMinYear(), $element->getMaxYear());
     $hourOptions = $this->getHoursOptions($pattern['hour']);
     $minuteOptions = $this->getMinutesOptions($pattern['minute']);
     $secondOptions = $this->getSecondsOptions($pattern['second']);
     $dayElement = $element->getDayElement()->setValueOptions($daysOptions);
     $monthElement = $element->getMonthElement()->setValueOptions($monthsOptions);
     $yearElement = $element->getYearElement()->setValueOptions($yearOptions);
     $hourElement = $element->getHourElement()->setValueOptions($hourOptions);
     $minuteElement = $element->getMinuteElement()->setValueOptions($minuteOptions);
     $secondElement = $element->getSecondElement()->setValueOptions($secondOptions);
     if ($element->shouldCreateEmptyOption()) {
         $dayElement->setEmptyOption('');
         $yearElement->setEmptyOption('');
         $monthElement->setEmptyOption('');
         $hourElement->setEmptyOption('');
         $minuteElement->setEmptyOption('');
         $secondElement->setEmptyOption('');
     }
     $data = array();
     $data[$pattern['day']] = $selectHelper->render($dayElement);
     $data[$pattern['month']] = $selectHelper->render($monthElement);
     $data[$pattern['year']] = $selectHelper->render($yearElement);
     $data[$pattern['hour']] = $selectHelper->render($hourElement);
     $data[$pattern['minute']] = $selectHelper->render($minuteElement);
     if ($element->shouldShowSeconds()) {
         $data[$pattern['second']] = $selectHelper->render($secondElement);
     } else {
         unset($pattern['second']);
         if ($shouldRenderDelimiters) {
             unset($pattern[4]);
         }
     }
     $markup = '';
     foreach ($pattern as $key => $value) {
         // Delimiter
         if (is_numeric($key)) {
             $markup .= $value;
         } else {
             $markup .= $data[$value];
         }
     }
     $markup = trim($markup);
     return $markup;
 }
开发者ID:jjs180,项目名称:dance-america,代码行数:66,代码来源:FormDateTimeSelect.php


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