You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

64 lines
1.3 KiB

<?php
namespace Drupal\sample_migration\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class TitleBodyParagraphForm.
*/
class TitleBodyParagraphForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'title_body_paragraph_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Submit'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state->getValues() as $key => $value) {
// @TODO: Validate fields.
}
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$batch = [
'title' => $this->t('Bringing over Title Body Field Collections...'),
'operations' => [
[
'sample_migration_title_body_paragraphs',
[
]
]
],
'init_message' => $this->t('Loading nodes...'),
'progress_message' => $this->t('Processed @current out of @total'),
'finished' => $this->t('sample_migration_title_body_paragraphs_finished')
];
batch_set($batch);
}
}