I’m looking for a little help with Custom Mapping for the Search Plus plugin. I think(?) I'm getting pretty close, but stuck on something (and I do front end web design, so this is just over my head) I’m using https://transition.topshelfcraft.com/software/craft/searchplus/usage/hooks-events as a reference and used https://pluginfactory.io to create the plugin.
Per the instructions in the documentation above, I’ve added this to the bottom of the plugin :
public function searchPlus_addAlgoliaMapping()
{
$ret = [];
$ret['name'] = 'GHCC Staff Mapping2';
$ret['handle'] = 'GHCC_Staff2';
$ret['description'] = 'Mapping for Staff Page';
$ret['method'] = 'example.testMapping';
return $ret;
}
public function testMapping(element)
{
$ret = [];
$ret['objectID'] = $entry->id;
$ret['title'] = $entry->title;
$ret['activityId'] = $entry->id;
$ret['id'] = $entry->id;
$ret['slug'] = $entry->slug;
$ret['url'] = $entry->url;
$ret['uri'] = '/' . $entry->uri;
return $ret;
}
But am getting an error: syntax error, unexpected ')', expecting variable (T_VARIABLE)
referencing line 186 public function testMapping(element)
Was wondering if anyone had any tips
Thanks!
$
sopublic function testMapping($entry)
will help