public function SourceCsvForm::access in Migrate Tools 8.4
A custom access check.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
\Drupal\migrate_plus\Entity\MigrationInterface $migration: The $migration.
Return value
\Drupal\Core\Access\AccessResult Allowed or forbidden, neutral if tempstore is empty.
1 string reference to 'SourceCsvForm::access'
File
- src/
Form/ SourceCsvForm.php, line 180
Class
- SourceCsvForm
- Provides an edit form for CSV source plugin column_names configuration.
Namespace
Drupal\migrate_tools\FormCode
public function access(AccountInterface $account, MigrationInterface $migration) {
try {
$this->migration = $this->migrationPluginManager
->createInstance($migration
->id(), $migration
->toArray());
} catch (PluginException $e) {
return AccessResult::forbidden();
}
if ($this->migration) {
if ($source = $this->migration
->getSourcePlugin()) {
if (is_a($source, CSV::class)) {
return AccessResult::allowed();
}
}
}
return AccessResult::forbidden();
}