/**
  * Implements \Drupal\block\BlockBase::build().
  */
 public function build()
 {
     $build = array();
     $node_type = NodeType::load($this->configuration['type']);
     if ($this->configuration['show_help']) {
         $build['help'] = array('#markup' => !empty($node_type->getHelp()) ? '<p>' . Xss::filterAdmin($node_type->getHelp()) . '</p>' : '');
     }
     $node = $this->entityManager->getStorage('node')->create(array('type' => $node_type->id()));
     $build['form'] = $this->entityFormBuilder->getForm($node);
     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;
 }