Skip to content
Merged
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
24 changes: 24 additions & 0 deletions quant.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
Expand Down Expand Up @@ -520,3 +521,26 @@ function quant_preprocess_views_view(array &$variables) {
}

}

/**
* Implements hook_node_view().
*/
function quant_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) {

// If there are any webforms in layout_builder, add warning for admins.
if ($node->hasField('layout_builder__layout') && !$node->get('layout_builder__layout')->isEmpty() && \Drupal::currentUser()->hasRole('administrator')) {
$sections = $node->get('layout_builder__layout')->getSections();

foreach ($sections as $section) {
$components = $section->getComponents();

foreach ($components as $component) {
$configuration = $component->get('configuration');
if (isset($configuration['webform_id'])) {
\Drupal::messenger()->addWarning(t('Forms need special handling for a static website. <a href="https://docs.quantcdn.io/integrations/drupal">See the documentation for your options</a>.'));
return;
}
}
}
}
}