Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent errors when importing page configuration for new homepage and errors when running bulk section creation #813

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion html/modules/custom/ghi_sections/src/SectionCreateBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public static function process(SectionManager $section_manager, array $bundle, $

// The basic query to retrieve base object ids.
$query = \Drupal::entityQuery('base_object')
->condition('type', $bundle, 'IN');
->condition('type', $bundle, 'IN')
->accessCheck(FALSE);

$result = $query->execute();

Expand Down
8 changes: 7 additions & 1 deletion html/modules/custom/hpc_common/src/Plugin/HPCBlockBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\hpc_common\Helpers\ContextHelper;
use Drupal\hpc_common\Helpers\RequestHelper;
use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;
use Drupal\layout_builder\SectionStorageInterface;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
Expand Down Expand Up @@ -385,7 +386,7 @@ public function setPage($page_parameters = NULL) {
$node = is_object($page_parameters['node']) ? $page_parameters['node'] : $entity_storage->load($page_parameters['node']);
$this->page = $node->bundle() . '_node';
}
elseif (!empty($page_parameters['section_storage'])) {
elseif (!empty($page_parameters['section_storage']) && $page_parameters['section_storage'] instanceof OverridesSectionStorage) {
// Layout builder editing context.
$entity = $page_parameters['section_storage']->getContextValue('entity');
if ($entity->bundle() == 'page_variant') {
Expand All @@ -398,6 +399,11 @@ public function setPage($page_parameters = NULL) {
$this->page = $entity->bundle() . '_' . $entity->getEntityTypeId();
}
}
elseif (!empty($page_parameters['entity'])) {
// Content entity, e.g. node.
$entity = $page_parameters['entity'];
$this->page = $entity->bundle() . '_' . $entity->getEntityTypeId();
}
else {
// No page identified.
$this->page = FALSE;
Expand Down
Loading