public function MigrationFormBase::exists in Migrate Tools 8.5
Same name and namespace in other branches
- 8 src/Form/MigrationFormBase.php \Drupal\migrate_tools\Form\MigrationFormBase::exists()
- 8.2 src/Form/MigrationFormBase.php \Drupal\migrate_tools\Form\MigrationFormBase::exists()
- 8.3 src/Form/MigrationFormBase.php \Drupal\migrate_tools\Form\MigrationFormBase::exists()
- 8.4 src/Form/MigrationFormBase.php \Drupal\migrate_tools\Form\MigrationFormBase::exists()
Checks for an existing migration group.
Parameters
string|int $entity_id: The entity ID.
array $element: The form element.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
Return value
bool TRUE if this format already exists, FALSE otherwise.
File
- src/
Form/ MigrationFormBase.php, line 98
Class
- MigrationFormBase
- Class MigrationFormBase.
Namespace
Drupal\migrate_tools\FormCode
public function exists($entity_id, array $element, FormStateInterface $form_state) {
$query = $this->entityTypeManager
->getStorage('migration')
->getQuery();
// Query the entity ID to see if its in use.
$result = $query
->condition('id', $element['#field_prefix'] . $entity_id)
->execute();
// We don't need to return the ID, only if it exists or not.
return (bool) $result;
}