You are here

public function ApiSync::getForms in FormAssembly 8

Get data about available forms.

Parameters

string $id: The id to use as a cache id.

Return value

array An array of objects representing FormAssembly forms.

File

src/ApiSync.php, line 126

Class

ApiSync
Service class for FormAssembly API: Handles form sync.

Namespace

Drupal\formassembly

Code

public function getForms($id = '') {

  /*
   * We need to cache forms and page count to facilitate batch processing.
   * So, see if there is a stored cache object with this ID.
   */
  $this
    ->loadFromCache($id);
  try {
    if ($this->isAdmin) {
      $finished = $this
        ->getAdminForms();
    }
    else {
      $finished = $this
        ->getStandardForms();
    }
    $this
      ->setCache($id);
    return $finished;
  } catch (\Exception $e) {
    $this->logger
      ->critical('FormAssembly getForms request failed with Exception: %exception_type.', [
      '%exception_type' => get_class($e),
    ]);
    throw $e;
  }
}