# Forums | Mahara Community

Posts: 16

21 February 2017, 11:01 AM

Was trying to get our groupviewimage plugin to work in 16.10.2 today however I noticed that the method get_artefact_metadata() from lib/view.php has been removed. What was the reasoning for this and what would be an alternative to use instead of that method?

Posts: 377

24 February 2017, 8:10 AM

Hi Jawyei,

It was removed in this commit https://reviews.mahara.org/#/c/6742/7/htdocs/lib/view.php

By the looks of the code you should be able to use  get_artefact_instances() as it does the task that get_artefact_metadata() did plus some extra stuff.

Cheers

Robert

Posts: 16

24 February 2017, 11:53 AM

Hi Robert

The returned $artefact_instances object's fields are all private. There are no methods I can find to get the field data without modifying lib/view.php. Is there another way to get the properties of each artefact in a view? Jawyei Posts: 377 ##### Re: get_artefact_metadata 24 February 2017, 12:45 PM Hi Jawyei, I note the get_artefact_instances() function also sets the$this->artefact_metadata as well

So with a View object $view one could try something like:$view->get_artefact_instances(); // populate the artefact_metadata
foreach ($view->get('artefact_metadata') as$metadata) {

... do something with $metadata ... } Let me know if that helps Cheers Robert Posts: 16 ##### Re: get_artefact_metadata 24 February 2017, 3:48 PM Hi Robert That method gives me an error of PHP Fatal error: Call to a member function get() on a non-object... I noticed that the get_artefact_instances() array already contains the metadata information and using the get() method I can immediate get the information I want.$theView = new View($aViewProperty['id']);$artefactInView = $theView->get_artefact_instances(); foreach($artefactInView as $anArtefact){ //for each artefact if($anArtefact->get('artefacttype') == 'image'){
$artefactID =$anArtefact->get('id'); //if it is an image artefact assign the id and break the loop
echo "artefactID=".\$artefactID;
break;
}

...

}

I will see if it can be done for folders (image gallery) later on.

Jawyei

Posts: 16