Created
December 12, 2017 10:47
-
-
Save alexey-kuznetsov/dacc686c4a782e618af0b20e38030cca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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