You are here

protected static function MigrationBase::machineFromClass in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/base.inc \MigrationBase::machineFromClass()

Given only a class name, derive a machine name (the class name with the "Migration" suffix, if any, removed).

Parameters

$class_name:

Return value

string

2 calls to MigrationBase::machineFromClass()
MigrationBase::registerMigration in includes/base.inc
Register a new migration process in the migrate_status table. This will generally be used in two contexts - by the class detection code for static (one instance per class) migrations, and by the module implementing dynamic (parameterized class)…
MigrationBase::__construct in includes/base.inc
Construction of a MigrationBase instance.

File

includes/base.inc, line 592
Defines the base class for migration processes.

Class

MigrationBase
The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…

Code

protected static function machineFromClass($class_name) {
  if (preg_match('/Migration$/', $class_name)) {
    $machine_name = drupal_substr($class_name, 0, strlen($class_name) - strlen('Migration'));
  }
  else {
    $machine_name = $class_name;
  }
  return $machine_name;
}