I am getting
InvalidArgumentException: The form argument Drupal\competition\Form\CompetitionForm::class is not a valid form. in Drupal\Core\Form\FormBuilder->getFormId() (line 190 of /home/test/public_html/core/lib/Drupal/Core/Form/FormBuilder.php).
This is my call in the block code
public function build() {
$builtForm = \Drupal::formBuilder()->getForm('Drupal\competition\Form\CompetitionForm::class');
$renderArray['form'] = $builtForm;
return $renderArray;
} This the first part of my form code
* @file
*/
namespace Drupal\competition\Form;
use Drupal\Core\Form\ConfigFormBase;
class CompetitionForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'competition_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['first_name'] = array(
'#name' => 'first_name',
'#id' => 'first_name',
'#type' => 'textfield',
'#title' => t('FIRST NAME:'),
'#required' => TRUE,
'#prefix' => '<div class="label-wrap">',
'#suffix' => '</div>',
);I can not see anything wrong with it but obviously there must be
Thanks