Skip to content

Better support for blocks with content that don't start with / contain <div> elements #1

@robaimes

Description

@robaimes

Blocks that don't contain a <div> element are being modified incorrectly. CMS block content does not always contain a <div> element.

  • The block doesn't use PageBuilder, so <div> is not mandatory
  • The block content has been added via setup script in which it does not contain a <div> element
    • If this is saved via the admin and PageBuilder is enabled, then this will fix it but requires manual intervention

To reproduce:

Create a CMS block via a setup script:

$cmsBlock = $this->blockInterfaceFactory->create();
$cmsBlock->setIdentifier('my_cool_new_cms_block');
    ->setTitle('My Cool New CMS Block')
    ->setContent('<p>My really cool new CMS block</p>')
    ->setData('stores', [0]);

$this->blockRepository->save($cmsBlock);

The content when rendered on the frontend is display as such:

M data-block-indentifier="my_cool_new_cms_block"y really cool new CMS block

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions