HTMLText AbsoluteLink parse placeholders #2515

Merged
merged 1 commit into from Sep 25, 2014

Projects

None yet

3 participants

@guttmann
Contributor
guttmann commented Oct 9, 2013

Fixes #1910

Left AbsoluteLinks method in Text and overrode it in HTMLText so that original tests continue to pass, removing the AbsoluteLinks method in Text would have resulted in many more changes being required and could have resulted in unexpected behaviour for users.

The AbsoluteLinks method in HTMLText now parses shortcodes before passing the value to HTTP::absoluteLinks.

Added to the RSSFeedTest to ensure that things continue working as expected.

@simonwelsh simonwelsh and 1 other commented on an outdated diff Oct 9, 2013
tests/api/RSSFeedTest.php
@@ -134,3 +150,22 @@ public function AbsoluteLink() {
return "http://www.example.com/item-c.html";
}
}
+
+class RSSFeedTest_ItemD extends ViewableData {
+ // ItemD test fields - all fields use casting but Content & AltContent cast as HTMLText
+ private static $casting = array(
+ 'Title' => 'Varchar',
+ 'Content' => 'HTMLText'
+ );
+
+ public $Title = 'ItemD';
+ public $Content = '<p>ItemD Content <a href="[sitetree_link,id=1]">link</a></p>';
@simonwelsh
simonwelsh Oct 9, 2013 Contributor

CMS coupling.

@guttmann
guttmann Oct 9, 2013 Contributor

That's true, do you have any suggestions for testing this without the CMS coupling?
Could I create and register a shortcode just for the testing?

@simonwelsh
Contributor

Can you squash your commits please?

@simonwelsh simonwelsh added the 3.1 label Mar 15, 2014
@guttmann @guttmann guttmann Fix HTMLText AbsoluteLinks not parsing placeholder
Add an AbsoluteLinks method to HTMLText that parses placeholders instead of returning the raw value.
cd4ebb2
@guttmann
Contributor
@halkyon halkyon merged commit 409aebf into silverstripe:3.1 Sep 25, 2014

1 check passed

default Scrutinizer: No new issues — Travis: Passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment