Ejemplo n.º 1
0
 /**
  * Implements \Drupal\block\BlockBase::build().
  */
 public function build()
 {
     $build = array();
     // Check if flood control has been activated for sending emails.
     if (!$this->currentUser->hasPermission('administer contact forms') && ($message = $this->floodControl())) {
         $build['message'] = array('#markup' => $message);
         return $build;
     }
     $message = $this->entityManager->getStorage('contact_message')->create(array('contact_form' => $this->contactForm->id()));
     $build['form'] = $this->entityFormBuilder->getForm($message);
     return $build;
 }