當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HeaderField::setAllowHTML方法代碼示例

本文整理匯總了PHP中HeaderField::setAllowHTML方法的典型用法代碼示例。如果您正苦於以下問題:PHP HeaderField::setAllowHTML方法的具體用法?PHP HeaderField::setAllowHTML怎麽用?PHP HeaderField::setAllowHTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HeaderField的用法示例。


在下文中一共展示了HeaderField::setAllowHTML方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($name, $title = null, $value = null, $modifier = null)
 {
     $this->name = $name . '[' . $modifier . ']';
     $this->setTitle($title);
     $this->modifier = $modifier;
     $dayArray = array(0 => 'Day');
     for ($i = 1; $i < 32; $i++) {
         if ($i < 10) {
             $dayArray['0' . $i] = $i;
         } else {
             $dayArray[$i] = $i;
         }
     }
     $monthArray = array('0' => 'Month', '01' => 'Jan', '02' => 'Feb', '03' => 'March', '04' => 'Apr', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'Aug', '09' => 'Sept', '10' => 'Oct', '11' => 'Nov', '12' => 'Dec');
     $now = new DateTime();
     $startYear = $now->format('Y');
     $endYear = $startYear - 105;
     $yearArray = array(0 => 'Year');
     for ($i = $startYear; $i >= $endYear; $i--) {
         $yearArray[$i] = $i;
     }
     $fields = array($this->day = new DropdownField($this->name . '[Day]', '', $dayArray), $this->month = new DropdownField($this->name . '[Month]', '', $monthArray), $this->year = new DropdownField($this->name . '[Year]', '', $yearArray));
     foreach ($fields as $field) {
         $field->addExtraClass('dateselectorfield');
     }
     if ($title) {
         if ($this->useHeading) {
             array_unshift($fields, $header = new HeaderField($this->name . $this->modifier . 'Title', trim($title . ' ' . $this->modifier), 4));
             $header->setAllowHTML(true);
         } else {
             array_unshift($fields, new LiteralField($this->name . $this->modifier . 'Title', '<label class="left" for="' . $this->name . '">' . trim($title . ' ' . $this->modifier) . '</label>'));
         }
     }
     Requirements::css('datedropdownselectorfield/css/admin.css');
     parent::__construct($fields);
     $this->setValue($value);
 }
開發者ID:helpfulrobot,項目名稱:dnadesign-silverstripe-datedropdownselectorfield,代碼行數:37,代碼來源:DateSelectorField.php


注:本文中的HeaderField::setAllowHTML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。