public function LayoutBuilderEntityViewDisplay::createCopy in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::createCopy()
Creates a duplicate of the entity display object on a different view mode.
The new object necessarily has the same $targetEntityType and $bundle properties than the original one.
Parameters
string $view_mode: The view mode for the new object.
Return value
static A duplicate of this object with the given view mode.
Overrides EntityDisplayBase::createCopy
File
- core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php, line 225
Class
- LayoutBuilderEntityViewDisplay
- Provides an entity view display entity that has a layout.
Namespace
Drupal\layout_builder\EntityCode
public function createCopy($mode) {
// Disable Layout Builder and remove any sections copied from the original.
return parent::createCopy($mode)
->setSections([])
->disableLayoutBuilder();
}