public function testPixlrEditorExtension() { $controller = new ContentController(); $toolbar = new HtmlEditorField_Toolbar($controller, 'DummyToolbar'); $imageForm = $toolbar->ImageForm(); // we expect the image form to now have the pixlr component inside $fields = $imageForm->Fields(); $this->assertNotNull($fields->dataFieldByName('NewPixlrImage')); }
public function testExtendImageFormFields() { if (class_exists('ThumbnailStripField')) { $controller = new Controller(); $toolbar = new HtmlEditorField_Toolbar($controller, 'DummyToolbar'); $imageForm = $toolbar->ImageForm(); $this->assertTrue(HtmlEditorFieldTest_DummyImageFormFieldExtension::$update_called); $this->assertEquals($imageForm->Fields(), HtmlEditorFieldTest_DummyImageFormFieldExtension::$fields); } else { $this->markTestSkipped('Test requires cms module (ThumbnailStripfield class)'); } }
public function viewfile($request) { $result = false; if ($origUrl = $request->getVar('FileURL')) { if (Director::is_site_url($origUrl) && VideoEmbed::GetByURL($origUrl)) { $video = VideoEmbed::GetByURL($origUrl); $result = $this->GetResultForVideo($video); } } else { if ($fileId = $request->getVar('ID')) { $video = VideoEmbed::get()->filter(array("HTML5VideoID" => $fileId))->first(); $result = $this->GetResultForVideo($video); } } return $result ? $result : parent::viewfile($request); }
/** * Return the CMS's HTML-editor toolbar */ public function EditorToolbar() { return HtmlEditorField_Toolbar::create($this, "EditorToolbar"); }
public function viewfile_getRemoteFileByURL($fileUrl) { return parent::viewfile_getRemoteFileByURL($fileUrl); }
public function testGetAnchors() { if (!class_exists('Page')) { $this->markTestSkipped(); } $html = '<div name="foo"></div> <div name=\'bar\'></div> <div id="baz"></div> <div id=\'bam\'></div> <div id = "baz"></div> <div id = ""></div> <div id="some\'id"></div> <div id=bar></div>'; $expected = array('foo', 'bar', 'baz', 'bam', "some'id"); $page = new Page(); $page->Title = 'Test'; $page->Content = $html; $page->write(); $this->useDraftSite(true); $request = new SS_HTTPRequest('GET', '/', array('PageID' => $page->ID)); $toolBar = new HtmlEditorField_Toolbar(new Controller(), 'test'); $toolBar->setRequest($request); $results = json_decode($toolBar->getanchors(), true); $this->assertEquals($expected, $results); }
public function testExtendImageFormFields() { $controller = new ContentController(); $toolbar = new HtmlEditorField_Toolbar($controller, 'DummyToolbar'); $imageForm = $toolbar->ImageForm(); $this->assertTrue(HtmlEditorFieldTest_DummyImageFormFieldExtension::$update_called); $this->assertEquals($imageForm->Fields(), HtmlEditorFieldTest_DummyImageFormFieldExtension::$fields); }