function BatchBuilder::setFile
Same name in other branches
- 9 core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::setFile()
- 8.9.x core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::setFile()
- 10 core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::setFile()
Sets the file that contains the callback functions.
The path should be relative to base_path(), and thus should be built using \Drupal\Core\Extension\ExtensionList::getPath(). Defaults to {module_name}.module.
The file needs to be set before using ::addOperation(), ::setFinishCallback(), or any other function that uses callbacks from the file. This is so that PHP knows about the included functions.
Parameters
string $filename: The path to the file.
Return value
$this
File
-
core/
lib/ Drupal/ Core/ Batch/ BatchBuilder.php, line 218
Class
- BatchBuilder
- Builds an array for a batch process.
Namespace
Drupal\Core\BatchCode
public function setFile($filename) {
include_once $filename;
$this->file = $filename;
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.