/** * Implements \Drupal\block\BlockBase::build(). */ public function build() { $build = array(); $account = $this->entityManager->getStorage('user')->create(array()); $build['form'] = $this->entityFormBuilder->getForm($account, 'register'); return $build; }
/** * 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; }