diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 1361b78d..c1c5a70a 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -26,7 +26,6 @@ use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FieldGroup; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FormAction; -use SilverStripe\Forms\FormField; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldDataColumns; use SilverStripe\Forms\HTMLEditor\HTMLEditorField; @@ -60,6 +59,7 @@ use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionProvider; use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\View\ArrayData; +use SilverStripe\View\HTML; use SilverStripe\View\Parsers\ShortcodeParser; use SilverStripe\View\Parsers\URLSegmentFilter; use SilverStripe\View\SSViewer; @@ -1280,24 +1280,24 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi { $tags = array(); if ($includeTitle && strtolower($includeTitle) != 'false') { - $tags[] = FormField::create_tag('title', array(), $this->obj('Title')->forTemplate()); + $tags[] = HTML::createTag('title', array(), $this->obj('Title')->forTemplate()); } $generator = trim(Config::inst()->get(self::class, 'meta_generator')); if (!empty($generator)) { - $tags[] = FormField::create_tag('meta', array( + $tags[] = HTML::createTag('meta', array( 'name' => 'generator', 'content' => $generator, )); } $charset = ContentNegotiator::config()->uninherited('encoding'); - $tags[] = FormField::create_tag('meta', array( + $tags[] = HTML::createTag('meta', array( 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=' . $charset, )); if ($this->MetaDescription) { - $tags[] = FormField::create_tag('meta', array( + $tags[] = HTML::createTag('meta', array( 'name' => 'description', 'content' => $this->MetaDescription, )); @@ -1307,11 +1307,11 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi && !$this instanceof ErrorPage && $this->ID > 0 ) { - $tags[] = FormField::create_tag('meta', array( + $tags[] = HTML::createTag('meta', array( 'name' => 'x-page-id', 'content' => $this->obj('ID')->forTemplate(), )); - $tags[] = FormField::create_tag('meta', array( + $tags[] = HTML::createTag('meta', array( 'name' => 'x-cms-edit-link', 'content' => $this->obj('CMSEditLink')->forTemplate(), )); diff --git a/code/Model/SiteTreeLinkTracking.php b/code/Model/SiteTreeLinkTracking.php index 5b19a79b..2e5d987f 100644 --- a/code/Model/SiteTreeLinkTracking.php +++ b/code/Model/SiteTreeLinkTracking.php @@ -3,13 +3,13 @@ namespace SilverStripe\CMS\Model; use SilverStripe\Assets\File; -use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\ManyManyList; use SilverStripe\Versioned\Versioned; use DOMElement; +use SilverStripe\View\Parsers\HTMLValue; /** * Adds tracking of links in any HTMLText fields which reference SiteTree or File items. @@ -111,7 +111,7 @@ class SiteTreeLinkTracking extends DataExtension $linkedPages = array(); $linkedFiles = array(); - $htmlValue = Injector::inst()->create('HTMLValue', $record->$fieldName); + $htmlValue = HTMLValue::create($record->$fieldName); $links = $this->parser->process($htmlValue); // Highlight broken links in the content. diff --git a/tests/model/SiteTreeLinkTrackingTest.php b/tests/model/SiteTreeLinkTrackingTest.php index 6cb1aa5f..d16831ef 100644 --- a/tests/model/SiteTreeLinkTrackingTest.php +++ b/tests/model/SiteTreeLinkTrackingTest.php @@ -1,9 +1,9 @@ create('HTMLValue', $content); + $htmlValue = HTMLValue::create($content); $links = $parser->process($htmlValue); if (empty($links[0])) {