$edit_link = $this->entity->toLink($this->t('Edit'), 'edit-form')->toString(); $logger = $this->logger('block_content'); if($status == SAVED_UPDATED){ $this->messenger()->addStatus($this->t('Block type %label has been updated.', ['%label' => $block_type->label()])); $logger->notice('Block type %label has been updated.', ['%label' => $block_type->label(), 'link' => $edit_link]); } else{ block_content_add_body_field($block_type->id()); $this->messenger()->addStatus($this->t('Block type %label has been added.', ['%label' => $block_type->label()])); $logger->notice('Block type %label has been added.', ['%label' => $block_type->label(), 'link' => $edit_link]); }
// Highlight is present with AddSectionController.
$this->assertHighlightedElement('[data-layout-builder-highlight-id="section-0"]'); $page->clickLink('Two column');
BlockContent::create([ 'type' => 'basic', 'info' => 'Block with link', 'body' => [ // Create a link that should be disabled in Layout Builder preview.
'value' => '<a id="link-that-should-be-disabled" href="/search/node">Take me away</a>', 'format' => 'full_html', ], ])->save();
// Add the body field to it.
block_content_add_body_field($bundle->id()); }
/**
* Tests moderating content blocks.
*
* Blocks and any non-node-type-entities do not have a concept of
* "published". As such, we must use the "default revision" to know what is
* going to be "published", i.e. visible to the user.
*
* The one exception is a block that has never been "published". When a block
* is first created, it becomes the "default revision". For each edit of the
* block after that, Content Moderation checks the "default revision" to
* see if it is set to a published moderation state. If it is not, the entity
* being saved will become the "default revision".
*
* The test below is intended, in part, to make this behavior clear.
*
* @see \Drupal\content_moderation\EntityOperations::entityPresave
* @see \Drupal\content_moderation\Tests\ModerationFormTest::testModerationForm
*/