diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/IsisConnector.php | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index 03c2bfe..e82174c 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -391,7 +391,7 @@ class IsisConnector { * Subfield name. * * @return - * Subfield keys. + * Subfield key. */ public function getSubfieldKey($field, $subfield) { $keys = array_flip($field['subfields']); @@ -401,6 +401,27 @@ class IsisConnector { } /** + * Get the item key. + * + * @param $field + * Field array. + * + * @param $item + * Item name. + * + * @return + * Item key. + */ + public function getItemKey($field, $item) { + if ($item == 'main') { + return $item; + } + else { + return $this->getSubfieldKey($field, $item); + } + } + + /** * Get the key of a field entry. * * @param $field @@ -675,6 +696,33 @@ class IsisConnector { } /** + * Return the existing key items for a result. + * + * @param $field + * Field data. + * + * @param $row + * Row number. + * + * @return + * Array with existing item keys + * + * @todo + * Write and test. + */ + public function existingItemKeys($field, $row = 0) { + $existing = array(); + + foreach (new IsisItemIterator($this, $field)) as $key => $item) { + if ($row == $key) { + $existing[] = $this->getItemKey($field, $item); + } + } + + return $existing; + } + + /** * Get a subfield name. * * @param $field_key |