🇻🇳Vietnam @cp19112000

Account created on 11 July 2024, 5 months ago
#

Recent comments

🇻🇳Vietnam cp19112000

I suggest using a different flag to handle custom logic instead of using copy_to_address_book (s.t like owner_presave_event_dispatched)
You can set owner_presave_event_dispatched to TRUE before adding a profile and then patch into the code "Make sure the billing profile is owned by the order, not the customer"
In my case, I customized some events in ProfileOwnerEvents to ensure the duplicated profile keeps owner_presave_event_dispatched TRUE and the owner is the customer. I don't want to use copy_to_address_book because the duplicated profile set copy_to_address_book to FALSE and set address_book_profile_id to the old profile, which made relationships between two profiles

      if ($billing_profile->getData('owner_presave_event_dispatched')) {
        $event = new ProfileOwnerEvent($billing_profile);
        $event_dispatcher = \Drupal::service('event_dispatcher');
        $event_dispatcher->dispatch($event, ProfileOwnerEvents::PROFILE_OWNER_PRESAVE);
        $billing_profile = $event->getProfile();
        $this->setData('owner_presave_event_dispatched', FALSE);
      }
🇻🇳Vietnam cp19112000

View mode of author will follow to view mode of parent entity (if has and teaser_normalize if does not have any view mode display has machine name same with parent entity) and also view mode of author of children entities will follow to view mode of parent.

Production build 0.71.5 2024