Skip to content

Commit

Permalink
FIX HTML showing in inline preview
Browse files Browse the repository at this point in the history
  • Loading branch information
sabina-talipova committed Jul 10, 2023
1 parent 341bc5a commit 450666c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/Block/BannerBlock.php
Expand Up @@ -78,10 +78,7 @@ public function CallToActionLink()
*/
public function getSummary()
{
if ($this->File() && $this->File()->exists()) {
return $this->getSummaryThumbnail() . $this->dbObject('Content')->Summary(20);
}
return '';
return $this->dbObject('Content')->Summary(20);
}

/**
Expand All @@ -92,7 +89,6 @@ public function getSummary()
protected function provideBlockSchema()
{
$blockSchema = parent::provideBlockSchema();
$blockSchema['content'] = $this->dbObject('Content')->Summary(20);
return $blockSchema;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Block/BannerBlockTest.php
Expand Up @@ -41,4 +41,16 @@ public function testNullStringCallToActionLink()
$block->write();
$this->assertNull($block->CallToActionLink());
}

public function testGetSummary()
{
/** @var BannerBlock $block */
$block = $this->objFromFixture(BannerBlock::class, 'block_with_content');

$summary = $block->getSummary();
$this->assertEquals(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
$summary
);
}
}
4 changes: 4 additions & 0 deletions tests/Block/BannerBlockTest.yml
@@ -1,3 +1,7 @@
SilverStripe\CMS\Model\SiteTree:
test_page:
Title: Test

SilverStripe\ElementalBannerBlock\Block\BannerBlock:
block_with_content:
Content: Lorem ipsum dolor sit amet, consectetur adipiscing elit.

0 comments on commit 450666c

Please sign in to comment.