function BatchBuilder::setFile
Same name in other branches
- 9 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()
- 11.x 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_get_path(). 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 217
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.