public function jDrupalConnect::get in jDrupal 8.0.x
Same name and namespace in other branches
- 8 src/Plugin/rest/resource/jDrupalConnect.php \Drupal\jDrupal\Plugin\rest\resource\jDrupalConnect::get()
File
- src/
Plugin/ rest/ resource/ jDrupalConnect.php, line 96
Class
- jDrupalConnect
- Provides a resource to get bundles by entity.
Namespace
Drupal\jDrupal\Plugin\rest\resourceCode
public function get() {
// @TODO this should probably be a POST instead
$account = \Drupal::currentUser();
$results = array(
'uid' => $account
->id(),
'name' => $account
->getAccountName(),
'roles' => $account
->getRoles(),
);
\Drupal::moduleHandler()
->alter('jdrupal_connect', $results);
$response = new ResourceResponse($results);
$response
->addCacheableDependency($account);
return $response;
throw new HttpException(t('jDrupal Connect GET Failed!'));
}