public function jDrupalConnect::get in jDrupal 8
Same name and namespace in other branches
- 8.0.x src/Plugin/rest/resource/jDrupalConnect.php \Drupal\jDrupal\Plugin\rest\resource\jDrupalConnect::get()
File
- src/
Plugin/ rest/ resource/ jDrupalConnect.php, line 74
Class
- jDrupalConnect
- A home for REST resources provided by jDrupal.
Namespace
Drupal\jDrupal\Plugin\rest\resourceCode
public function get() {
$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!'));
}