Skip to content

Instantly share code, notes, and snippets.

@akiyamaSM
Last active February 26, 2020 10:14
Show Gist options
  • Select an option

  • Save akiyamaSM/b38541da42cd7880546c92adefbe2462 to your computer and use it in GitHub Desktop.

Select an option

Save akiyamaSM/b38541da42cd7880546c92adefbe2462 to your computer and use it in GitHub Desktop.
<?php
namespace Drupal\JobApplication\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class ApplyForm extends FormBase
{
/**
* @inheritDoc
*/
public function getFormId()
{
return 'jobapplication_settings';
}
/**
* @inheritDoc
*/
public function buildForm(array $form, FormStateInterface $form_state, $reference = null)
{
$form['reference'] = [
'#type' => 'textfield',
'#title' => $this->t('Example reference'),
'#value' => $reference
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Submit'),
];
return $form;
}
/**
* @inheritDoc
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
die('sss');
}
}
job_application:
path: /jobs
defaults:
_controller: Drupal\JobApplication\Controller\JobsController::index
requirements:
_permission: 'access content'
job_application_apply:
path: /jobs/apply/{reference}
defaults:
_controller: Drupal\JobApplication\Controller\JobsController::show
methods: [GET]
requirements:
_permission: 'access content'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment