protected function ImgTagToEmbedFilter::variableGet in Media Migration 8
Reads a variable from a source Drupal database.
Parameters
\Drupal\Core\Database\Connection $connection: The source database connection.
string $name: Name of the variable.
mixed $default: The default value.
Return value
mixed The unserialized value of the Drupal 7 variable, of the given default.
1 call to ImgTagToEmbedFilter::variableGet()
- ImgTagToEmbedFilter::transform in src/
Plugin/ migrate/ process/ ImgTagToEmbedFilter.php - Performs the associated process.
File
- src/
Plugin/ migrate/ process/ ImgTagToEmbedFilter.php, line 264
Class
- ImgTagToEmbedFilter
- Transforms <img src="/files/cat.png"> tags to <drupal-media …>.
Namespace
Drupal\media_migration\Plugin\migrate\processCode
protected function variableGet(Connection $connection, string $name, $default) {
try {
$result = $connection
->select('variable', 'v')
->fields('v', [
'value',
])
->condition('name', $name)
->execute()
->fetchField();
} catch (\Exception $e) {
$result = FALSE;
}
return $result !== FALSE ? unserialize($result) : $default;
}