diff options
author | Silvio <silvio@devlet.com.br> | 2010-09-03 18:12:40 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-09-03 18:12:40 -0300 |
commit | f49ad3720c73f21562f6699d7c6c3f1fae89e35e (patch) | |
tree | 7daab84fc3d8096267448e4234bd89ee55b56433 | |
parent | c234c4996b109eeede37b726d3d97d609ea20a5d (diff) | |
download | cinisis-f49ad3720c73f21562f6699d7c6c3f1fae89e35e.tar.gz cinisis-f49ad3720c73f21562f6699d7c6c3f1fae89e35e.tar.bz2 |
getSubfieldName supporting field passed by code or name
-rw-r--r-- | classes/IsisConnector.php | 2 | ||||
-rw-r--r-- | classes/IsisMap.php | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index 2ab2ee8..69eb36d 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -258,7 +258,7 @@ class IsisConnector extends IsisMap { $has = $this->hasMainItem($field, $row); } else { - $subfield = $this->getSubfieldName($this->getFieldKey($field), $item); + $subfield = $this->getSubfieldName($field, $item); $has = $this->hasSubfield($field, $subfield, $row); } diff --git a/classes/IsisMap.php b/classes/IsisMap.php index 05c7ae9..61df038 100644 --- a/classes/IsisMap.php +++ b/classes/IsisMap.php @@ -261,16 +261,21 @@ class IsisMap extends IsisReader { /** * Get a subfield name. * - * @param $field_key - * Field key. + * @param $field + * Field name or key. * * @param $subfield_key * Subfield key. * + * @param $by_key + * Set to true if you're passing the field key instead of it's name. + * * @return * Subfield name. */ - public function getSubfieldName($field_key, $subfield_key) { + public function getSubfieldName($field, $subfield_key, $by_key = FALSE) { + $field_key = (!$by_key) ? $this->getFieldKey($field) : $field; + if (isset($this->format['fields'][$field_key]['subfields'][$subfield_key])) { return $this->format['fields'][$field_key]['subfields'][$subfield_key]; } |