/** * Filter the display of the Item Type element set, if present. * * @param array $elementsBySet * @return array */ protected function _filterItemTypeElements($elementsBySet) { if ($this->_record instanceof Item) { if ($this->_record->item_type_id) { // Overwrite elements assigned to the item type element set with only // those that belong to this item's particular item type. This is // necessary because, otherwise, all item type elements will be shown. $itemTypeElementSetName = $this->_record->getProperty('item_type_name') . ' ' . ElementSet::ITEM_TYPE_NAME; // Check to see if either the generic or specific Item Type element // set has been chosen, i.e. 'Item Type Metadata' or 'Document // Item Type Metadata', etc. $itemTypeElements = $this->_record->getItemTypeElements(); if (!empty($this->_elementSetsToShow)) { if (in_array($itemTypeElementSetName, $this->_elementSetsToShow) or in_array(ElementSet::ITEM_TYPE_NAME, $this->_elementSetsToShow)) { $elementsBySet[$itemTypeElementSetName] = $itemTypeElements; } } else { $elementsBySet[$itemTypeElementSetName] = $itemTypeElements; } } // Unset the existing 'Item Type' element set b/c it shows elements // for all item types. unset($elementsBySet[ElementSet::ITEM_TYPE_NAME]); } return $elementsBySet; }