From f49ad3720c73f21562f6699d7c6c3f1fae89e35e Mon Sep 17 00:00:00 2001 From: Silvio Date: Fri, 3 Sep 2010 18:12:40 -0300 Subject: getSubfieldName supporting field passed by code or name --- classes/IsisConnector.php | 2 +- classes/IsisMap.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'classes') 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]; } -- cgit v1.2.3