Skip to content
Snippets Groups Projects
Commit 4e96093f authored by Oleksandr Kuzava's avatar Oleksandr Kuzava
Browse files

Issue #3293030: TypeError: Argument 1 passed to...

Issue #3293030: TypeError: Argument 1 passed to Drupal\single_content_sync\ContentSyncHelper::access() must implement interface Drupal\Core\Entity\EntityInterface, string given
parent cf61a0ae
No related branches found
No related tags found
1 merge request!22Issue #3293030: TypeError: Argument 1 passed to...
......@@ -3,6 +3,7 @@
namespace Drupal\single_content_sync\Form;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
......@@ -241,11 +242,20 @@ class ContentExportForm extends FormBase {
}
/**
* {@inheritdoc}
* Check if user has access to the export form.
*/
public function access() {
$parameters = $this->getRouteMatch()->getParameters();
$entity = $parameters->getIterator()->current();
if (is_string($entity)) {
$entity = $parameters->get($entity);
}
if (!$entity instanceof EntityInterface) {
return AccessResult::forbidden();
}
$hasAccess = $this->contentSyncHelper->access($entity);
return $hasAccess ? AccessResult::allowed() : AccessResult::forbidden();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment