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


PHP HTMLEditorField::setValue方法代碼示例

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


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

示例1: syncLinkTracking

 function syncLinkTracking()
 {
     // Build a list of HTMLText fields
     $allFields = $this->db();
     $htmlFields = array();
     foreach ($allFields as $field => $fieldSpec) {
         if (preg_match('/([^(]+)/', $fieldSpec, $matches)) {
             $class = $matches[0];
             if (class_exists($class)) {
                 if ($class == 'HTMLText' || is_subclass_of($class, 'HTMLText')) {
                     $htmlFields[] = $field;
                 }
             }
         }
     }
     $linkedPages = array();
     $linkedFiles = array();
     $this->HasBrokenLink = false;
     $this->HasBrokenFile = false;
     foreach ($htmlFields as $field) {
         $formField = new HTMLEditorField($field);
         $formField->setValue($this->{$field});
         $formField->saveInto($this);
     }
     $this->extend('augmentSyncLinkTracking');
 }
開發者ID:eLBirador,項目名稱:AllAboutCity,代碼行數:26,代碼來源:SiteTree.php

示例2: testReadonlyField

    public function testReadonlyField()
    {
        $editor = new HTMLEditorField('Content');
        $fileID = $this->idFromFixture('Image', 'example_image');
        $editor->setValue(sprintf('[image src="assets/HTMLEditorFieldTest_example.jpg" width="10" height="20" id="%d"]', $fileID));
        /** @var HTMLReadonlyField $readonly */
        $readonly = $editor->performReadonlyTransformation();
        /** @var DBHTMLText $readonlyContent */
        $readonlyContent = $readonly->Field();
        $this->assertEquals(<<<EOS
<span class="readonly typography" id="Content">
\t<img src="/assets/HTMLEditorFieldTest/f5c7c2f814/HTMLEditorFieldTest-example__ResizedImageWyIxMCIsIjIwIl0.jpg" alt="HTMLEditorFieldTest example" width="10" height="20">
</span>


EOS
, $readonlyContent->getValue());
        // Test with include input tag
        $readonly = $editor->performReadonlyTransformation()->setIncludeHiddenField(true);
        /** @var DBHTMLText $readonlyContent */
        $readonlyContent = $readonly->Field();
        $this->assertEquals(<<<EOS
<span class="readonly typography" id="Content">
\t<img src="/assets/HTMLEditorFieldTest/f5c7c2f814/HTMLEditorFieldTest-example__ResizedImageWyIxMCIsIjIwIl0.jpg" alt="HTMLEditorFieldTest example" width="10" height="20">
</span>

\t<input type="hidden" name="Content" value="[image src=&quot;/assets/HTMLEditorFieldTest/f5c7c2f814/HTMLEditorFieldTest-example.jpg&quot; width=&quot;10&quot; height=&quot;20&quot; id=&quot;{$fileID}&quot;]" />


EOS
, $readonlyContent->getValue());
    }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:32,代碼來源:HTMLEditorFieldTest.php


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