Commit fadb6ec3 authored by ramya balasubramanian's avatar ramya balasubramanian Committed by micropat
Browse files

Issue #3158968 by Ramya Balasubramanian: Error on Preview of an unsaved new...

Issue #3158968 by Ramya Balasubramanian: Error on Preview of an unsaved new node, The "node" entity cannot have a URI as it does not have an ID
parent 4e487480
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -88,6 +88,11 @@ function addtoany_entity_extra_field_info() {
 * Implements hook_ENTITY_TYPE_view().
 */
function addtoany_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
  // Prevent error on preview of an unpublished node.
  if ($entity->id() === NULL) {
    return;
  }

  if ($display->getComponent('addtoany')) {
    $config = Drupal::config('addtoany.settings');
    $isAllowed = $config->get("entities.{$entity->getEntityTypeId()}");