Metadata() for $elementText


#1

hi, I want to exclude some metadata fields from generating the element_texts table content, inspired by that discussion https://omeka.org/forums-legacy/topic/hiding-dublin-core-element-from-simple-search/

public function filterSearchElementTexts($elementTexts)
{

  foreach ($elementTexts as $index => $elementText) {

    $elementId = metadata($elementText, 'element_id');
    //check if the elementId is one of the ones
    //you want to clobber. Maybe get that directly from the table,
    //our use Omeka's functions to look them up
    $skipElementIds = array(50, 51); //dc title and type in my installation
    if (in_array($elementId, $skipElementIds)) {
        unset($elementTexts[$index]);
    }
  }
return $elementTexts;
}

one can find the element_id:

$elementId = metadata($elementText, ‘element_id’);

and there just remove the unwanted fields from the array. But does that code apply for elements other than Dublin Core (and used as Item Type Metadata)? How to get/check the id of the element outside the classic DC fields?


#2

Have you tried the Hide Elements plugin?