Skip to content

Instantly share code, notes, and snippets.

@alexey-kuznetsov
Created December 12, 2017 10:47
Show Gist options
  • Select an option

  • Save alexey-kuznetsov/dacc686c4a782e618af0b20e38030cca to your computer and use it in GitHub Desktop.

Select an option

Save alexey-kuznetsov/dacc686c4a782e618af0b20e38030cca to your computer and use it in GitHub Desktop.
<?php
namespace Drupal\wx_stepped_add_form\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Url;
use Drupal\wx_stepped_add_form\Form\SteppedAddForm;
/**
* Class SteppedAddFormController.
*/
class SteppedAddFormController extends ControllerBase {
/**
* SteppedAddFormController constructor.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* @param \Drupal\Core\Session\AccountInterface $current_user
* @param \Drupal\Core\Form\FormBuilderInterface $formBuilder
*/
public function __construct(EntityManagerInterface $entity_manager, AccountInterface $current_user, FormBuilderInterface $formBuilder) {
$this->entityManager = $entity_manager;
$this->currentUser = $current_user;
$this->formBuilder = $formBuilder;
}
/**
* Page.
*
* @return array
* Return content.
*/
public function page() {
if ($this->user->id()) {
return $this->formBuilder->getForm(SteppedAddForm::class);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment