public function PanelizerUser::getDefaultDisplay in Panelizer 8.3
Same name and namespace in other branches
- 8.5 src/Plugin/PanelizerEntity/PanelizerUser.php \Drupal\panelizer\Plugin\PanelizerEntity\PanelizerUser::getDefaultDisplay()
- 8.4 src/Plugin/PanelizerEntity/PanelizerUser.php \Drupal\panelizer\Plugin\PanelizerEntity\PanelizerUser::getDefaultDisplay()
Creates a default Panels display from the core Entity display.
As much as possible, this should attempt to make the settings on the Panels display match the existing core settings, so that ideally the user doesn't notice any change upon Panelizing an entity's view mode.
Parameters
\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The entity view display holding the display options configured for the entity components.
string $bundle: The bundle to panelize.
string $view_mode: The view mode to panelize.
Return value
\Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant
Overrides PanelizerEntityBase::getDefaultDisplay
File
- src/
Plugin/ PanelizerEntity/ PanelizerUser.php, line 21
Class
- PanelizerUser
- Panelizer entity plugin for integrating with users.
Namespace
Drupal\panelizer\Plugin\PanelizerEntityCode
public function getDefaultDisplay(EntityViewDisplayInterface $display, $bundle, $view_mode) {
$panels_display = parent::getDefaultDisplay($display, $bundle, $view_mode)
->setPageTitle('[user:name]');
// Remove the 'name' block because it's covered already.
foreach ($panels_display
->getRegionAssignments() as $region => $blocks) {
/** @var \Drupal\Core\Block\BlockPluginInterface[] $blocks */
foreach ($blocks as $block_id => $block) {
if ($block
->getPluginId() == 'entity_field:user:name') {
$panels_display
->removeBlock($block_id);
}
}
}
if ($display
->getComponent('member_for')) {
// @todo: add block for 'Member for'.
}
return $panels_display;
}