/** * Substitute field values in placehoders like [[Field Title]] from current record * * @param string $placeholder * * @throws ilException * @return string */ protected function substituteFieldValue($placeholder) { if (isset(self::$cache_fields[$placeholder])) { $field = self::$cache_fields[$placeholder]; } else { $table = ilDataCollectionCache::getTableCache($this->record->getTableId()); // TODO May need caching per table in future $field_title = preg_replace('#^\\[\\[(.*)\\]\\]#', "\$1", $placeholder); $field = $table->getFieldByTitle($field_title); if ($field === NULL) { // Workaround for standardfields - title my be ID $field = $table->getField($field_title); if ($field === NULL) { global $lng; /** * @var $lng ilLanguage */ $lng->loadLanguageModule('dcl'); // throw new ilException("Field with title '$field_title' not found"); throw new ilException(sprintf($lng->txt('dcl_err_formula_field_not_found'), $field_title)); } } self::$cache_fields[$placeholder] = $field; } return $this->record->getRecordFieldHTML($field->getId()); }