/** * Returns display description for element specified by standard "get" bundle code (eg. <table_name>.<bundle_name> format) */ public function getDisplayDescription($ps_field) { $va_tmp = explode('.', $ps_field); if (sizeof($va_tmp) == 2 && $va_tmp[0] == $this->getLabelTableName() && $va_tmp[1] == $this->getLabelDisplayField()) { $va_tmp[0] = $this->tableName(); $va_tmp[1] = 'preferred_labels'; $ps_field = join('.', $va_tmp); } switch (sizeof($va_tmp)) { # ------------------------------------- case 1: // table_name if ($t_instance = $this->_DATAMODEL->getInstanceByTableName($va_tmp[0], true)) { return _t("A list of related %1", $t_instance->getProperty('NAME_PLURAL')); } break; # ------------------------------------- # ------------------------------------- case 2: // table_name.field_name // table_name.field_name case 3: // table_name.field_name.sub_element if (!($t_instance = $this->_DATAMODEL->getInstanceByTableName($va_tmp[0], true))) { return null; } $vs_suffix = ''; if ($va_tmp[0] !== $this->tableName()) { $vs_suffix = ' ' . _t('from related %1', $t_instance->getProperty('NAME_PLURAL')); } switch ($va_tmp[1]) { # -------------------- case 'related': unset($va_tmp[1]); return _t('A list of related %1', $t_instance->getProperty('NAME_PLURAL')); break; # -------------------- # -------------------- case 'preferred_labels': if (method_exists($t_instance, 'getLabelTableInstance') && ($t_label_instance = $t_instance->getLabelTableInstance())) { if (!isset($va_tmp[2])) { return _t('A list of %1 %2', $t_label_instance->getProperty('NAME_PLURAL'), $vs_suffix); } else { return _t('A list of %1 %2', $t_label_instance->getDisplayLabel($t_label_instance->tableName() . '.' . $va_tmp[2]), $vs_suffix); } } break; # -------------------- # -------------------- case 'nonpreferred_labels': if (method_exists($t_instance, 'getLabelTableInstance') && ($t_label_instance = $t_instance->getLabelTableInstance())) { if (!isset($va_tmp[2])) { return _t('A list of alternate %1 %2', $t_label_instance->getProperty('NAME_PLURAL'), $vs_suffix); } else { return _t('A list of alternate %1 %2', $t_label_instance->getDisplayLabel($t_label_instance->tableName() . '.' . $va_tmp[2]), $vs_suffix); } } break; # -------------------- # -------------------- case 'media': if ($va_tmp[0] === 'ca_object_representations') { if ($va_tmp[2]) { return _t('A list of related media representations using version "%1"', $va_tmp[2]); } else { return _t('A list of related media representations using the default version'); } } break; # -------------------- # -------------------- default: if ($va_tmp[0] !== $this->tableName()) { return _t('A list of %1 %2', $t_instance->getDisplayLabel($ps_field), $vs_suffix); } break; # -------------------- } break; # ------------------------------------- } return parent::getDisplayDescription($ps_field); }