/** * Collects ISBN, LCCN, and OCLC numbers to use in calling preview APIs * * @return array */ public function getPreviewIds() { // Extract identifiers from record driver if it supports appropriate methods: $isbn = is_callable([$this->driver, 'getCleanISBN']) ? $this->driver->getCleanISBN() : ''; $lccn = is_callable([$this->driver, 'getLCCN']) ? $this->driver->getLCCN() : ''; $oclc = is_callable([$this->driver, 'getOCLC']) ? $this->driver->getOCLC() : []; // Turn identifiers into class names to communicate with jQuery logic: $idClasses = []; if (!empty($isbn)) { $idClasses[] = 'ISBN' . $isbn; } if (!empty($lccn)) { $idClasses[] = 'LCCN' . $lccn; } if (!empty($oclc)) { foreach ($oclc as $oclcNum) { if (!empty($oclcNum)) { $idClasses[] = 'OCLC' . $oclcNum; } } } return $idClasses; }