function _layout_builder_bundle_has_no_layouts
Determines if there are zero layout overrides for the bundle.
Parameters
string $entity_type_id: The entity type ID.
string $bundle: The bundle name.
Return value
bool TRUE if there are zero layout overrides for the bundle, otherwise FALSE.
1 call to _layout_builder_bundle_has_no_layouts()
- layout_builder_post_update_make_layout_untranslatable in core/
modules/ layout_builder/ layout_builder.post_update.php - Set the layout builder field as non-translatable where possible.
File
-
core/
modules/ layout_builder/ layout_builder.post_update.php, line 255
Code
function _layout_builder_bundle_has_no_layouts($entity_type_id, $bundle) {
$entity_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $entity_update_manager->getEntityType($entity_type_id);
$bundle_key = $entity_type->getKey('bundle');
$query = \Drupal::entityTypeManager()->getStorage($entity_type_id)
->getQuery();
if ($bundle_key) {
$query->condition($bundle_key, $bundle);
}
if ($entity_type->isRevisionable()) {
$query->allRevisions();
}
$query->exists(OverridesSectionStorage::FIELD_NAME)
->accessCheck(FALSE)
->range(0, 1);
$results = $query->execute();
return empty($results);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.