Update HTMLValue and FormField::create_tag usages

This commit is contained in:
Damian Mooyman 2017-04-18 10:52:51 +12:00
parent 8a426a40de
commit 93a185e44a
3 changed files with 11 additions and 11 deletions

View File

@ -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(),
));

View File

@ -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.

View File

@ -1,9 +1,9 @@
<?php
use SilverStripe\CMS\Model\SiteTreeLinkTracking_Parser;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Assets\File;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\View\Parsers\HTMLValue;
class SiteTreeLinkTrackingTest extends SapphireTest
{
@ -11,7 +11,7 @@ class SiteTreeLinkTrackingTest extends SapphireTest
protected function isBroken($content)
{
$parser = new SiteTreeLinkTracking_Parser();
$htmlValue = Injector::inst()->create('HTMLValue', $content);
$htmlValue = HTMLValue::create($content);
$links = $parser->process($htmlValue);
if (empty($links[0])) {