You are here

public function EntityLegalMethodProfileForm::execute in Entity Legal 7.2

Same name and namespace in other branches
  1. 7 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_inline':
        $document_render_array = entity_view(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, array(
          $document,
        ));
        $form[$field_name]['#prefix'] = render($document_render_array);
        break;
    }
  }
}