Policy on the inclusion of Migrate in Core for 8.0.0

When the decision was made at DrupalCon Prague to remove the major version (D6/7 => D8) upgrade path in lieu of using Migrate for major version upgrades, we agreed that we were not going to hold up Drupal 8's release on Migrate being supported.

This document provides clarification around this policy. See original discussion at https://www.drupal.org/node/2313651.

Testing

Finally for some QA. Let's check that our module works as expected by writing a few tests of our own which can be run via Drupal itself.

/src/Tests/LoremIpsumTests.php

<?php

namespace Drupal\loremipsum\Tests;

use Drupal\simpletest\WebTestBase;

/**
* Tests for the Lorem Ipsum module.
* @group loremipsum
*/
class LoremIpsumTests extends WebTestBase {

  /**
   * Modules to install
   *
   * @var array
   */
  public static $modules = array('loremipsum');

Defining a Block

Remember at the beginning of this tutorial when I said we'd define a block with a form? Well, now's the time to get right on it.

/src/Form/LoremIpsumBlockForm.php

<?php

/**
* @file
* Contains \Drupal\loremipsum\Form\BlockFormController
*/

namespace Drupal\loremipsum\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

Settings

Everything's pretty neat so far, but how do we change what we're seeing? With some forms, of course.

/src/Form/LoremIpsumForm.php

<?php

/**
* @file
* Contains \Drupal\loremipsum\Form\LoremIpsumForm.
*/

namespace Drupal\loremipsum\Form;

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;

class LoremIpsumForm extends ConfigFormBase {

  /**
   * {@inheritdoc}.
   */
  public function getFormId() {
    return 'loremipsum_form';
  }

Theming

loremipsum.module

/**
* Implements hook_theme().
*/
function loremipsum_theme($existing, $type, $theme, $path) {
  $variables = array(
    'loremipsum' => array(
      'variables' => array(
        'source_text' => NULL,
      ),
      'template' => 'loremipsum',
    ),
  );
  return $variables;
}

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x