@@ -105,19 +105,8 @@ public static function sendEnvelope(
105105 public static function makeEnvelopes ($ app , $ signerName , $ signerEmail , $ pdfDoc , $ demoPath ): EnvelopeDefinition
106106 {
107107 $ appId = $ app ['appId ' ] ?? null ;
108- $ extensionGroupId = $ app ['tabs ' ][0 ]['extensionData ' ]['extensionGroupId ' ] ?? null ;
109- $ publisherName = $ app ['tabs ' ][0 ]['extensionData ' ]['publisherName ' ] ?? null ;
110- $ applicationName = $ app ['tabs ' ][0 ]['extensionData ' ]['applicationName ' ] ?? null ;
111- $ actionName = $ app ['tabs ' ][0 ]['extensionData ' ]['actionName ' ] ?? null ;
112- $ actionInputKey = $ app ['tabs ' ][0 ]['extensionData ' ]['actionInputKey ' ] ?? null ;
113- $ actionContract = $ app ['tabs ' ][0 ]['extensionData ' ]['actionContract ' ] ?? null ;
114- $ extensionName = $ app ['tabs ' ][0 ]['extensionData ' ]['extensionName ' ] ?? null ;
115- $ extensionContract = $ app ['tabs ' ][0 ]['extensionData ' ]['extensionContract ' ] ?? null ;
116- $ requiredForExtension = $ app ['tabs ' ][0 ]['extensionData ' ]['requiredForExtension ' ] ?? null ;
117- $ tabLabels = implode (', ' , array_column ($ app ['tabs ' ], 'tabLabel ' ));
118- $ connectionKey = $ app ['tabs ' ][0 ]['extensionData ' ]['connectionInstances ' ][0 ]['connectionKey ' ] ?? null ;
119- $ connectionValue = $ app ['tabs ' ][0 ]['extensionData ' ]['connectionInstances ' ][0 ]['connectionValue ' ] ?? null ;
120-
108+ $ tabLabels = $ app ['tabs ' ];
109+
121110 $ contentBytes = file_get_contents ($ demoPath . $ pdfDoc );
122111 $ base64FileContent = base64_encode ($ contentBytes );
123112
@@ -141,52 +130,72 @@ public static function makeEnvelopes($app, $signerName, $signerEmail, $pdfDoc, $
141130 'anchor_units ' => 'pixels ' ,
142131 'anchor_x_offset ' => '20 '
143132 ]);
144-
145- $ textTab = new Text ([
146- "require_initial_on_shared_change " => false ,
147- "require_all " => false ,
148- "name " => $ applicationName ,
149- "required " => true ,
150- "locked " => false ,
151- "disable_auto_size " => false ,
152- "max_length " => 4000 ,
153- "tab_label " => $ tabLabels ,
154- "font " => "lucidaconsole " ,
155- "font_color " => "black " ,
156- "font_size " => "size9 " ,
157- "document_id " => "1 " ,
158- "recipient_id " => "1 " ,
159- "page_number " => "1 " ,
160- "x_position " => "273 " ,
161- "y_position " => "191 " ,
162- "width " => "84 " ,
163- "height " => "22 " ,
164- "template_required " => false ,
165- "tab_type " => "text " ,
166- "extensionData " => [
167- "extension_group_id " => $ extensionGroupId ,
168- "publisher_name " => $ publisherName ,
169- "application_id " => $ appId ,
170- "application_name " => $ applicationName ,
171- "action_name " => $ actionName ,
172- "action_contract " => $ actionContract ,
173- "extension_name " => $ extensionName ,
174- "extension_contract " => $ extensionContract ,
175- "required_for_extension " => $ requiredForExtension ,
176- "action_input_key " => $ actionInputKey ,
177- "extension_policy " => "None " ,
178- "connection_instances " => [
179- [
180- "connection_key " => $ connectionKey ,
181- "connection_value " => $ connectionValue
133+
134+ $ textTabs = [];
135+
136+ foreach ($ tabLabels as $ tab ) {
137+ $ connectionKey = $ tab ['extensionData ' ]['connectionInstances ' ][0 ]['connectionKey ' ] ?? null ;
138+ $ connectionValue = $ tab ['extensionData ' ]['connectionInstances ' ][0 ]['connectionValue ' ] ?? null ;
139+ $ extensionGroupId = $ tab ['extensionData ' ]['extensionGroupId ' ] ?? null ;
140+ $ publisherName = $ tab ['extensionData ' ]['publisherName ' ] ?? null ;
141+ $ applicationName = $ tab ['extensionData ' ]['applicationName ' ] ?? null ;
142+ $ actionName = $ tab ['extensionData ' ]['actionName ' ] ?? null ;
143+ $ actionInputKey = $ tab ['extensionData ' ]['actionInputKey ' ] ?? null ;
144+ $ actionContract = $ tab ['extensionData ' ]['actionContract ' ] ?? null ;
145+ $ extensionName = $ tab ['extensionData ' ]['extensionName ' ] ?? null ;
146+ $ extensionContract = $ tab ['extensionData ' ]['extensionContract ' ] ?? null ;
147+ $ requiredForExtension = $ tab ['extensionData ' ]['requiredForExtension ' ] ?? null ;
148+
149+ $ textTab = new Text ([
150+ "require_initial_on_shared_change " => false ,
151+ "require_all " => false ,
152+ "name " => $ applicationName ,
153+ "required " => true ,
154+ "locked " => false ,
155+ "disable_auto_size " => false ,
156+ "max_length " => 4000 ,
157+ "tab_label " => $ tab ["tabLabel " ],
158+ "font " => "lucidaconsole " ,
159+ "font_color " => "black " ,
160+ "font_size " => "size9 " ,
161+ "document_id " => "1 " ,
162+ "recipient_id " => "1 " ,
163+ "page_number " => "1 " ,
164+ "x_position " => "273 " ,
165+ "y_position " => 170 + 20 * count ($ textTabs ),
166+ "width " => "84 " ,
167+ "height " => "22 " ,
168+ "template_required " => false ,
169+ "tab_type " => "text " ,
170+ "extensionData " => [
171+ "extension_group_id " => $ extensionGroupId ,
172+ "publisher_name " => $ publisherName ,
173+ "application_id " => $ appId ,
174+ "application_name " => $ applicationName ,
175+ "action_name " => $ actionName ,
176+ "action_contract " => $ actionContract ,
177+ "extension_name " => $ extensionName ,
178+ "extension_contract " => $ extensionContract ,
179+ "required_for_extension " => $ requiredForExtension ,
180+ "action_input_key " => $ actionInputKey ,
181+ "extension_policy " => "MustVerifyToSign " ,
182+ "connection_instances " => [
183+ [
184+ "connection_key " => $ connectionKey ,
185+ "connection_value " => $ connectionValue
186+ ]
182187 ]
183188 ]
184- ]
185- ]);
189+ ]);
190+
191+ array_push ($ textTabs , $ textTab );
192+ }
193+
194+
186195
187196 $ signerTabs = new Tabs ([
188197 'sign_here_tabs ' => [$ signHere ],
189- 'text_tabs ' => [ $ textTab ]
198+ 'text_tabs ' => $ textTabs
190199 ]);
191200 $ signer ->setTabs ($ signerTabs );
192201
0 commit comments