public function EntityLegalMethodProfileForm::execute in Entity Legal 7
Same name and namespace in other branches
- 7.2 methods/entity_legal.profile_form.inc \EntityLegalMethodProfileForm::execute()
Execution method for profile form method.
Parameters
array $form: The user register form to affect.
File
- methods/
entity_legal.profile_form.inc, line 29 - Method include file for 'form_link' and 'form_inline'.
Class
- EntityLegalMethodProfileForm
- Method class for displaying a checkbox on the user register form.
Code
public function execute(array &$form) {
$documents = $this
->getProfileFormMethodDocuments();
foreach ($documents as $document) {
$field_name = 'legal_' . $document
->identifier();
$form[$field_name] = array(
'#type' => 'checkbox',
'#title' => $document
->getAcceptanceLabel(),
'#default_value' => $document
->userHasAgreed(),
'#required' => TRUE,
);
switch ($document
->getAcceptanceDeliveryMethod(TRUE)) {
case 'form_link':
$document_uri = $document
->uri();
$form[$field_name]['#description'] = t('Read the document at !url', array(
'!url' => l(url($document_uri['path'], array(
'absolute' => TRUE,
)), $document_uri['path']),
));
break;
case 'form_inline':
$document_render_array = entity_view(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, array(
$document,
));
$form[$field_name]['#prefix'] = render($document_render_array);
break;
}
}
}