I’ve a kind outlined in mymodule/src/Type/myForm.php
namespace DrupalmymoduleForm; use DrupalCoreFormFormBase; use DrupalCoreFormFormStateInterface; class myForm extends FormBase { /** * Specify Drupal Developer kind ID. */ public perform getFormId() { return 'mymodule_myform'; } /** * Construct Drupal Developer precise kind. */ public perform buildForm(array $kind, FormStateInterface $form_state) { // Type API code right here...
Initially, this routing labored advantageous and Drupal Developer kind displayed at Drupal Developer right path:
mymodule.single_tab: path: '/node/{node}/edit/efficiency' defaults: _form: 'DrupalmymoduleFormmyForm' _title: 'Add efficiency'
Then I wanted so as to add a customized entry test, limiting to a particular content material kind:
mymodule.single_tab: path: '/node/{node}/edit/efficiency' defaults: _title: 'Add efficiency' _controller: 'DrupalmymoduleControllermymoduleController::content material' necessities: _custom_access: 'DrupalmymoduleControllermymoduleController::checkAccess'
Drupal Development entry test works advantageous. Now I feel I’ve to show my kind in Drupal Developer controller:
namespace DrupalmymoduleController; use DrupalCoreControllerControllerBase; use DrupalCoreFormFormBuilderInterface; use DrupalCoreAccessAccessResult; use DrupalnodeEntityNode; /** * Controller for Add Efficiency single tab. */ class mymoduleController extends ControllerBase { /** * Returns Drupal Developer add single efficiency kind. */ public perform content material() { $kind = $this->formBuilder->getForm('DrupalmymoduleFormmyForm'); return [ '#type' => 'markup', '#markup' => $form ]; }
This fails to show Drupal Developer kind, and I get:
Name to a member perform getForm() on null
I attempted defining my kind builder class inside Drupal Developer controller as an alternative, however identical end result. What am I doing improper?