You are here

private function MappedObjectForm::getDrupalEntityFromUrl in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 5.0.x modules/salesforce_mapping_ui/src/Form/MappedObjectForm.php \Drupal\salesforce_mapping_ui\Form\MappedObjectForm::getDrupalEntityFromUrl()

Helper to fetch the contextual Drupal entity.

1 call to MappedObjectForm::getDrupalEntityFromUrl()
MappedObjectForm::buildForm in modules/salesforce_mapping_ui/src/Form/MappedObjectForm.php
Form constructor.

File

modules/salesforce_mapping_ui/src/Form/MappedObjectForm.php, line 265

Class

MappedObjectForm
Salesforce Mapping Form base.

Namespace

Drupal\salesforce_mapping_ui\Form

Code

private function getDrupalEntityFromUrl() {

  // Fetch the current entity from context.
  // @TODO what if there's more than one entity in route params?
  $entity_type_id = $this->request->query
    ->get('entity_type_id');
  $entity_id = $this->request->query
    ->get('entity_id');
  if (empty($entity_id) || empty($entity_type_id)) {
    return FALSE;
  }
  return $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->load($entity_id);
}