Project

General

Profile

« Previous | Next » 

Revision e56e5d1c

Added by Andreas Kohlbecker over 5 years ago

adding test case for no sensu but with Combination Authors and fixing according bug

View differences:

modules/cdm_dataportal/cdm_api/tagged_text.inc
293 293
  return $extracted_tt;
294 294
}
295 295

  
296
function tagged_text_extract(&$tagged_text, $type) {
296
function tagged_text_extract(&$tagged_text, $type, $replace_with_placeholder = false) {
297 297
  $matching_elements = array();
298 298
  if (is_array($tagged_text)) {
299 299
    for ($i = 0; $i < count($tagged_text) - 1; $i++) {
300 300
      if($tagged_text[$i]->type == $type){
301 301
        $matching_elements[] = $tagged_text[$i];
302
        unset($tagged_text[$i]);
302
        if($replace_with_placeholder){
303
          // text must not be null, see cdm_tagged_text_to_markup()
304
          $tagged_text[$i] = tagged_text_new("PLACEHOLDER_" . $type, "PLACEHOLDER_" . $type);
305
        } else {
306
          unset($tagged_text[$i]);
307
        }
303 308
      }
304 309
    }
305 310
  }

Also available in: Unified diff