You are here

public static function DrupalGatherContentClient::getAccountId in GatherContent 8.5

Same name and namespace in other branches
  1. 8.4 src/DrupalGatherContentClient.php \Drupal\gathercontent\DrupalGatherContentClient::getAccountId()

Retrieve the account id of the given account.

If none given, retrieve the first account by default.

5 calls to DrupalGatherContentClient::getAccountId()
drush_gathercontent_list_status in ./gathercontent.drush.inc
Implements drush_COMMAND().
MappingCreator::getProjects in gathercontent_upload/src/Export/MappingCreator.php
Returns all projects for given account.
MappingImportForm::form in gathercontent_ui/src/Form/MappingImportForm.php
Gets the actual form array to be built.
MappingImportForm::save in gathercontent_ui/src/Form/MappingImportForm.php
Form submission handler for the 'save' action.
MappingListBuilder::render in gathercontent_ui/src/MappingListBuilder.php
Builds the entity listing as renderable array for table.html.twig.

File

src/DrupalGatherContentClient.php, line 37

Class

DrupalGatherContentClient
Extends the GatherContentClient class with Drupal specific functionality.

Namespace

Drupal\gathercontent

Code

public static function getAccountId($accountName = NULL) {
  $account = \Drupal::config('gathercontent.settings')
    ->get('gathercontent_account');
  $account = unserialize($account);
  if (!is_array($account)) {
    return NULL;
  }
  if (!$accountName) {
    if (reset($account)) {
      return key($account);
    }
  }
  foreach ($account as $id => $name) {
    if ($name === $accountName) {
      return $id;
    }
  }
  return NULL;
}