This makes it easier to display in the UI what a search is for,
e.g. `->addSelect('api_entity:label')` would return "Contacts" for a search of Contacts.
return CRM_Utils_System::url($path, ['reset' => 1, 'ssID' => $id]);
}
+ /**
+ * Retrieve pseudoconstant options for $this->api_entity field
+ * @return array
+ */
+ public static function getApiEntityOptions() {
+ return Civi\Api4\Entity::get(FALSE)
+ ->addSelect('name', 'title_plural')
+ ->addOrderBy('title_plural')
+ ->execute()
+ ->indexBy('name')
+ ->column('title_plural');
+ }
+
}
*
* Generated from xml/schema/CRM/Contact/SavedSearch.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c884fe02dfd203d381429f83672e1a9e)
+ * (GenCodeChecksum:5e5799b7755c435363f2c8cdafd13055)
*/
/**
'entity' => 'SavedSearch',
'bao' => 'CRM_Contact_BAO_SavedSearch',
'localizable' => 0,
+ 'pseudoconstant' => [
+ 'callback' => 'CRM_Contact_BAO_SavedSearch::getApiEntityOptions',
+ ],
'add' => '5.24',
],
'api_params' => [
<length>255</length>
<comment>Entity name for API based search</comment>
<add>5.24</add>
+ <pseudoconstant>
+ <callback>CRM_Contact_BAO_SavedSearch::getApiEntityOptions</callback>
+ </pseudoconstant>
</field>
<field>