Skip to content

Commit

Permalink
Merge pull request #1793 from open-sausages/pulls/4.0/requirements-ht…
Browse files Browse the repository at this point in the history
…ml-cleanup

Update HTMLValue and FormField::create_tag usages
  • Loading branch information
flamerohr committed Jun 16, 2017
2 parents 8a426a4 + 93a185e commit d14e000
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions code/Model/SiteTree.php
Expand Up @@ -26,7 +26,6 @@
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;
Expand Down Expand Up @@ -60,6 +59,7 @@
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;
Expand Down Expand Up @@ -1280,24 +1280,24 @@ public function MetaTags($includeTitle = true)
{
$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,
));
Expand All @@ -1307,11 +1307,11 @@ public function MetaTags($includeTitle = true)
&& !$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(),
));
Expand Down
4 changes: 2 additions & 2 deletions code/Model/SiteTreeLinkTracking.php
Expand Up @@ -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.
Expand Down Expand Up @@ -111,7 +111,7 @@ public function trackLinksInField($fieldName)
$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.
Expand Down
4 changes: 2 additions & 2 deletions tests/model/SiteTreeLinkTrackingTest.php
@@ -1,17 +1,17 @@
<?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
{

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])) {
Expand Down

0 comments on commit d14e000

Please sign in to comment.