public function NodeEntityBundleController::getFormInfoByUrl in Permissions by Term 8.2
Same name and namespace in other branches
- 8 src/Controller/NodeEntityBundleController.php \Drupal\permissions_by_term\Controller\NodeEntityBundleController::getFormInfoByUrl()
Return value
1 string reference to 'NodeEntityBundleController::getFormInfoByUrl'
File
- src/
Controller/ NodeEntityBundleController.php, line 72
Class
- NodeEntityBundleController
- Class NodeEntityBundleController
Namespace
Drupal\permissions_by_term\ControllerCode
public function getFormInfoByUrl() {
$contentType = $this
->getContentType(\Drupal::request()->query
->get('url'));
if ($contentType === NULL) {
return new JsonResponse([]);
}
$fields = $this->entityFieldManager
->getFieldDefinitions('node', $contentType);
$fieldNames = [];
foreach ($fields as $field) {
$fieldDefinitionSettings = $field
->getSettings();
if (!empty($fieldDefinitionSettings['target_type']) && $fieldDefinitionSettings['target_type'] == 'taxonomy_term') {
$fieldNames[] = $field
->getFieldStorageDefinition()
->getName();
}
}
return new JsonResponse([
'taxonomyRelationFieldNames' => $fieldNames,
'permissions' => $this->nodeEntityBundleInfo
->getPermissions(),
]);
}