From 9fce5b2eb39a6b70835c29b106cf1bfe05aa6218 Mon Sep 17 00:00:00 2001 From: Julian Pustkuchen Date: Thu, 8 Feb 2018 12:50:31 +0100 Subject: [PATCH] Expand the registrant form by default if there is only The registrant form can and should be expanded by default if there is only one person type bundle. It saves one click (UX) on the button in this case. If that should not happen by default in the view of the maintainer there should be at least an option to do this, because it's helpful in many cases where a quick simple registration form is required. --- src/Element/Registrants.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Element/Registrants.php b/src/Element/Registrants.php index b087c5a..12b7f5f 100644 --- a/src/Element/Registrants.php +++ b/src/Element/Registrants.php @@ -127,6 +127,10 @@ public static function processIdentityElement(array &$element, FormStateInterfac $arity_is_multiple = $utility->getArity() === 'multiple'; $arity_is_single = !$arity_is_multiple; $change_it = $utility->getChangeIt(); + if(count($for_bundles) == 1){ + // Show the form directly if it's single persond and only one bundle: + $utility->setShowCreateEntitySubform(TRUE); + } $entity_create_form = $utility->getShowCreateEntitySubform(); if (!$change_it) {