protected function CustomerProfile::selectDefaultProfile in Commerce Core 8.2
Selects a default profile from the given set of address book profiles.
Parameters
\Drupal\profile\Entity\ProfileInterface[] $address_book_profiles: The address book profiles.
Return value
\Drupal\profile\Entity\ProfileInterface|false The selected default profile, or FALSE if no profiles were given.
1 call to CustomerProfile::selectDefaultProfile()
- CustomerProfile::buildInlineForm in modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php - Builds the inline form.
File
- modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php, line 577
Class
- CustomerProfile
- Provides an inline form for managing a customer profile.
Namespace
Drupal\commerce_order\Plugin\Commerce\InlineFormCode
protected function selectDefaultProfile(array $address_book_profiles) {
$default_profile = reset($address_book_profiles);
foreach ($address_book_profiles as $profile) {
if ($profile
->isDefault()) {
$default_profile = $profile;
break;
}
}
return $default_profile;
}