Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
59
vendor/chi-teck/drupal-code-generator/templates/d8/form/config.twig
vendored
Normal file
59
vendor/chi-teck/drupal-code-generator/templates/d8/form/config.twig
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\{{ machine_name }}\Form;
|
||||
|
||||
use Drupal\Core\Form\ConfigFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Configure {{ name }} settings for this site.
|
||||
*/
|
||||
class {{ class }} extends ConfigFormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return '{{ form_id }}';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getEditableConfigNames() {
|
||||
return ['{{ machine_name }}.settings'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form['example'] = [
|
||||
'#type' => 'textfield',
|
||||
'#title' => $this->t('Example'),
|
||||
'#default_value' => $this->config('{{ machine_name }}.settings')->get('example'),
|
||||
];
|
||||
return parent::buildForm($form, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
if ($form_state->getValue('example') != 'example') {
|
||||
$form_state->setErrorByName('example', $this->t('The value is not correct.'));
|
||||
}
|
||||
parent::validateForm($form, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$this->config('{{ machine_name }}.settings')
|
||||
->set('example', $form_state->getValue('example'))
|
||||
->save();
|
||||
parent::submitForm($form, $form_state);
|
||||
}
|
||||
|
||||
}
|
44
vendor/chi-teck/drupal-code-generator/templates/d8/form/confirm.twig
vendored
Normal file
44
vendor/chi-teck/drupal-code-generator/templates/d8/form/confirm.twig
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\{{ machine_name }}\Form;
|
||||
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Provides a confirmation form before clearing out the examples.
|
||||
*/
|
||||
class {{ class }} extends ConfirmFormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return '{{ form_id }}';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return $this->t('Are you sure you want to do this?');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCancelUrl() {
|
||||
return new Url('system.admin_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
// @DCG Place your code here.
|
||||
$this->messenger()->addStatus($this->t('Done!'));
|
||||
$form_state->setRedirectUrl($this->getCancelUrl());
|
||||
}
|
||||
|
||||
}
|
7
vendor/chi-teck/drupal-code-generator/templates/d8/form/route.twig
vendored
Normal file
7
vendor/chi-teck/drupal-code-generator/templates/d8/form/route.twig
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{ route_name }}:
|
||||
path: '{{ route_path }}'
|
||||
defaults:
|
||||
_title: '{{ route_title }}'
|
||||
_form: 'Drupal\{{ machine_name }}\Form\{{ class }}'
|
||||
requirements:
|
||||
_permission: '{{ route_permission }}'
|
59
vendor/chi-teck/drupal-code-generator/templates/d8/form/simple.twig
vendored
Normal file
59
vendor/chi-teck/drupal-code-generator/templates/d8/form/simple.twig
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\{{ machine_name }}\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Provides a {{ name }} form.
|
||||
*/
|
||||
class {{ class }} extends FormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return '{{ form_id }}';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
|
||||
$form['message'] = [
|
||||
'#type' => 'textarea',
|
||||
'#title' => $this->t('Message'),
|
||||
'#required' => TRUE,
|
||||
];
|
||||
|
||||
$form['actions'] = [
|
||||
'#type' => 'actions',
|
||||
];
|
||||
$form['actions']['submit'] = [
|
||||
'#type' => 'submit',
|
||||
'#value' => $this->t('Send'),
|
||||
];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
if (mb_strlen($form_state->getValue('message')) < 10) {
|
||||
$form_state->setErrorByName('name', $this->t('Message should be at least 10 characters.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$this->messenger()->addStatus($this->t('The message has been sent.'));
|
||||
$form_state->setRedirect('<front>');
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue