|
|
- <?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);
- }
-
- }
|