diff --git a/core/lib/Drupal/Core/Form/FormState.php b/core/lib/Drupal/Core/Form/FormState.php index 1fcba6d..5bed64a 100644 --- a/core/lib/Drupal/Core/Form/FormState.php +++ b/core/lib/Drupal/Core/Form/FormState.php @@ -432,14 +432,14 @@ public function setFormState(array $form_state_additions) { /** * {@inheritdoc} */ - public function loadInclude($type, $module, $name = NULL) { + public function loadInclude($module, $type, $name = NULL) { if (!isset($name)) { $name = $module; } $build_info = $this->get('build_info'); if (!isset($build_info['files']["$module:$name.$type"])) { // Only add successfully included files to the form state. - if ($result = $this->moduleLoadInclude($type, $module, $name)) { + if ($result = $this->moduleLoadInclude($module, $type, $name)) { $build_info['files']["$module:$name.$type"] = array( 'type' => $type, 'module' => $module, @@ -848,10 +848,10 @@ protected function drupalSetMessage($message = NULL, $type = 'status', $repeat = } /** - * Wraps module_load_include(). + * Wraps ModuleHandler::loadInclude(). */ - protected function moduleLoadInclude($type, $module, $name = NULL) { - return module_load_include($type, $module, $name); + protected function moduleLoadInclude($module, $type, $name = NULL) { + return \Drupal::moduleHandler()->loadInclude($module, $type, $name); } } diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php index a8581d7..b99bff6 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php @@ -360,9 +360,9 @@ public function testLoadInclude() { ->getMock(); $form_state->expects($this->once()) ->method('moduleLoadInclude') - ->with($type, $module, $name) + ->with($module, $type, $name) ->willReturn(TRUE); - $this->assertTrue($form_state->loadInclude($type, $module, $name)); + $this->assertTrue($form_state->loadInclude($module, $type, $name)); } /** @@ -376,9 +376,9 @@ public function testLoadIncludeNoName() { ->getMock(); $form_state->expects($this->once()) ->method('moduleLoadInclude') - ->with($type, $module, $module) + ->with($module, $type, $module) ->willReturn(TRUE); - $this->assertTrue($form_state->loadInclude($type, $module)); + $this->assertTrue($form_state->loadInclude($module, $type)); } /** @@ -392,9 +392,9 @@ public function testLoadIncludeNotFound() { ->getMock(); $form_state->expects($this->once()) ->method('moduleLoadInclude') - ->with($type, $module, $module) + ->with($module, $type, $module) ->willReturn(FALSE); - $this->assertFalse($form_state->loadInclude($type, $module)); + $this->assertFalse($form_state->loadInclude($module, $type)); } /** @@ -418,7 +418,7 @@ public function testLoadIncludeAlreadyLoaded() { $form_state->expects($this->never()) ->method('moduleLoadInclude'); - $this->assertFalse($form_state->loadInclude($type, $module, $name)); + $this->assertFalse($form_state->loadInclude($module, $type, $name)); } }