public function FieldEntryFormController::edit in Flag 8.4
Return the flagging edit form.
Parameters
\Drupal\flag\FlagInterface $flag: The flag entity.
mixed $entity_id: The entity ID.
Return value
array The processed edit form for the given flagging.
Throws
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException Thrown if the flagging could not be found.
1 string reference to 'FieldEntryFormController::edit'
File
- src/
Controller/ FieldEntryFormController.php, line 100
Class
- FieldEntryFormController
- Provides a controller for the Field Entry link type.
Namespace
Drupal\flag\ControllerCode
public function edit(FlagInterface $flag, $entity_id) {
$entity = $this->flagService
->getFlaggableById($flag, $entity_id);
// If we couldn't find the flaggable, throw a 404.
if (!$entity) {
throw new NotFoundHttpException('The flagged entity could not be found.');
}
// Load the flagging from the flag and flaggable.
$flagging = $this->flagService
->getFlagging($flag, $entity);
// If we couldn't find the flagging, we can't edit. Throw a 404.
if (!$flagging) {
throw new NotFoundHttpException('The flagged entity could not be found.');
}
return $this
->getForm($flagging, 'edit');
}