public function GroupContentController::addForm in Group 2.0.x
Same name and namespace in other branches
- 8 src/Entity/Controller/GroupContentController.php \Drupal\group\Entity\Controller\GroupContentController::addForm()
Provides the group content submission form.
Parameters
\Drupal\group\Entity\GroupInterface $group: The group to add the group content to.
string $plugin_id: The group relation to add content with.
Return value
array A group submission form.
File
- src/
Entity/ Controller/ GroupContentController.php, line 227
Class
- GroupContentController
- Returns responses for GroupContent routes.
Namespace
Drupal\group\Entity\ControllerCode
public function addForm(GroupInterface $group, $plugin_id) {
$plugin = $group
->getGroupType()
->getContentPlugin($plugin_id);
$values = [
'type' => $plugin
->getContentTypeConfigId(),
'gid' => $group
->id(),
];
$group_content = $this
->entityTypeManager()
->getStorage('group_content')
->create($values);
return $this->entityFormBuilder
->getForm($group_content, 'add');
}