diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
index cde78ae..52779b6 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
@@ -8,13 +8,66 @@
 namespace Drupal\custom_block;
 
 use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Entity\EntityControllerInterface;
+use Drupal\Core\Entity\EntityStorageControllerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Entity\EntityFormControllerNG;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Language\LanguageManager;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Cache\Cache;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Form controller for the custom block edit forms.
  */
-class CustomBlockFormController extends EntityFormControllerNG {
+class CustomBlockFormController extends EntityFormControllerNG implements EntityControllerInterface {
+
+  /**
+   * The request.
+   *
+   * @var \Symfony\Component\HttpFoundation\Request
+   */
+  protected $request;
+
+  /**
+   * The custom block storage controller.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
+   */
+  protected $storageController;
+
+  /**
+   * Constructs a CustomBlockFormController object.
+   *
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface
+   *   The Module Handler.
+   * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage_controller
+   *   The action storage controller.
+   * @param \Symfony\Component\HttpFoundation\Request
+   *   The Request.
+   * @param \Drupal\Core\Language\LanguageManager
+   *   The Language Manager.
+   */
+  public function __construct(ModuleHandlerInterface $module_handler, EntityStorageControllerInterface $storage_controller, Request $request, LanguageManager $language_manager) {
+    parent::__construct($module_handler);
+
+    $this->storageController = $storage_controller;
+    $this->request = $request;
+    $this->languageManager = $language_manager;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
+    return new static(
+      $container->get('module_handler'),
+      $container->get('plugin.manager.entity')->getStorageController($entity_type),
+      $container->get('request'),
+      $container->get('language_manager')
+    );
+  }
 
   /**
    * Overrides \Drupal\Core\Entity\EntityFormController::prepareEntity().
@@ -69,11 +122,10 @@ public function form(array $form, array &$form_state) {
       '#description' => t('A brief description of your block. Used on the <a href="@overview">Blocks administration page</a>.', array('@overview' => url('admin/structure/block'))),
     );
 
-    $language_configuration = module_invoke('language', 'get_default_configuration', 'custom_block', $block->type->value);
-
+    $language_configuration = $this->moduleHandler->invoke('language', 'get_default_configuration', array('custom_block', $block->type->value));
     // Set the correct default language.
     if ($block->isNew() && !empty($language_configuration['langcode'])) {
-      $language_default = language($language_configuration['langcode']);
+      $language_default = $this->languageManager->getLanguage($language_configuration['langcode']);
       $block->langcode->value = $language_default->id;
     }
 
@@ -202,7 +254,7 @@ public function save(array $form, array &$form_state) {
     }
 
     // Clear the page and block caches.
-    cache_invalidate_tags(array('content' => TRUE));
+    Cache::invalidateTags(array('content' => TRUE));
   }
 
   /**
@@ -210,7 +262,7 @@ public function save(array $form, array &$form_state) {
    */
   public function delete(array $form, array &$form_state) {
     $destination = array();
-    $query = \Drupal::request()->query;
+    $query = $this->request->query;
     if (!is_null($query->get('destination'))) {
       $destination = drupal_get_destination();
       $query->remove('destination');
@@ -225,7 +277,7 @@ public function delete(array $form, array &$form_state) {
   public function validateForm(array &$form, array &$form_state) {
     if ($this->entity->isNew()) {
       // @todo Inject this once https://drupal.org/node/2060865 is in.
-      $exists = \Drupal::entityManager()->getStorageController('custom_block')->loadByProperties(array('info' => $form_state['values']['info']));
+      $exists = $this->storageController->loadByProperties(array('info' => $form_state['values']['info']));
       if (!empty($exists)) {
         form_set_error('info', t('A block with description %name already exists.', array(
         '%name' => $form_state['values']['info']
