Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BatchBuilder.php

function 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\Batch

Code

public function setFile($filename) {
    include_once $filename;
    $this->file = $filename;
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal