*
* Creating a new ACL requires at minimum an entity table, entity ID and object_table.
*
+ * @searchable false
* @see https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control
* @package Civi\Api4
*/
*
* Creating a new ActionSchedule requires at minimum a title, mapping_id and entity_value.
*
+ * @searchable false
* @see https://docs.civicrm.org/user/en/latest/email/scheduled-reminders/
* @package Civi\Api4
*/
* @package Civi\Api4
*/
class ContactType extends Generic\DAOEntity {
+ use Generic\Traits\OptionList;
}
* CustomField entity.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/
- *
+ * @searchable false
* @package Civi\Api4
*/
class CustomField extends Generic\DAOEntity {
* CustomGroup entity.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/
- *
+ * @searchable false
* @package Civi\Api4
*/
class CustomGroup extends Generic\DAOEntity {
* Displaying an item to a user is done with the `DashboardContact` entity.
*
* @see \Civi\Api4\DashboardContact
+ * @searchable false
* @package Civi\Api4
*/
class Dashboard extends Generic\DAOEntity {
* This places a dashboard item on a user's home screen.
*
* @see \Civi\Api4\Dashboard
+ * @searchable false
* @package Civi\Api4
*/
class DashboardContact extends Generic\DAOEntity {
* Domains - multisite instances of CiviCRM.
*
* @see https://docs.civicrm.org/sysadmin/en/latest/setup/multisite/
- *
+ * @searchable false
* @package Civi\Api4
*/
class Domain extends Generic\DAOEntity {
'name' => 'dao',
'description' => 'Class name for dao-based entities',
],
+ [
+ 'name' => 'searchable',
+ 'description' => 'Should this entity be selectable in search kit UI',
+ ],
[
'name' => 'paths',
'data_type' => 'Array',
foreach (ReflectionUtils::getTraits(static::class) as $trait) {
$info['type'][] = self::stripNamespace($trait);
}
+ $info['searchable'] = !in_array('OptionList', $info['type']);
$reflection = new \ReflectionClass(static::class);
- $info += ReflectionUtils::getCodeDocs($reflection, NULL, ['entity' => $info['name']]);
+ $info = array_merge($info, ReflectionUtils::getCodeDocs($reflection, NULL, ['entity' => $info['name']]));
unset($info['package'], $info['method']);
return $info;
}
* A bridge is a small table that provides an intermediary link between two other tables.
*
* The API can automatically incorporate a Bridge into a join expression.
+ *
+ * Note: at time of writing this trait does nothing except affect the "type" shown in Entity::get() metadata.
*/
trait EntityBridge {
* An optionList is a small entity whose primary purpose is to supply a semi-static list of options to fields in other entities.
*
* The options appear in the field metadata for other entities that reference this one via pseudoconstant.
+ *
+ * Note: At time of writing, this trait does nothing except toggle the searchable flag, (and adds "OptionList" to the "type" in Entity::get() metadata).
+ * @searchable false (FYI annotation isn't functional because this is a trait - workaround in AbstractEntity::getInfo)
*/
trait OptionList {
* GroupNesting entity.
*
* @see \Civi\Api4\Group
- *
+ * @searchable false
* @package Civi\Api4
*/
class GroupNesting extends Generic\DAOEntity {
* @package Civi\Api4
*/
class GroupOrganization extends Generic\DAOEntity {
+ use Generic\Traits\EntityBridge;
}
namespace Civi\Api4;
/**
- * ContributionPage entity.
+ * LocBlock entity.
*
+ * Links addresses, emails & phones to Events.
+ *
+ * @searchable false
* @package Civi\Api4
*/
class LocBlock extends Generic\DAOEntity {
/**
* MailSettings entity.
*
+ * @searchable false
* @package Civi\Api4
*/
class MailSettings extends Generic\DAOEntity {
*
* This is a collection of MappingFields, for reuse in import, export, etc.
*
+ * @searchable false
* @package Civi\Api4
*/
class Mapping extends Generic\DAOEntity {
* This represents one field in a Mapping collection.
*
* @see \Civi\Api4\Mapping
- *
+ * @searchable false
* @package Civi\Api4
*/
class MappingField extends Generic\DAOEntity {
* MsgTemplate entity.
*
* This is a collection of MsgTemplate, for reuse in import, export, etc.
- *
+ * @searchable false
* @package Civi\Api4
*/
class MessageTemplate extends Generic\DAOEntity {
/**
* Navigation entity.
*
+ * @searchable false
* @package Civi\Api4
*/
class Navigation extends Generic\DAOEntity {
* @package Civi\Api4
*/
class OptionGroup extends Generic\DAOEntity {
+ use Generic\Traits\OptionList;
}
* @package Civi\Api4
*/
class PaymentProcessor extends Generic\DAOEntity {
+ use Generic\Traits\OptionList;
}
* Relationship entity.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/relationships/
- *
+ * @searchable false
* @package Civi\Api4
*/
class Relationship extends Generic\DAOEntity {
* Note: this is a read-only api as routes are set via xml files and hooks.
*
* @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMenu/
- *
+ * @searchable false
* @package Civi\Api4
*/
class Route extends \Civi\Api4\Generic\AbstractEntity {
* Stores search parameters for populating smart groups with live results.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/smart-groups/
+ * @searchable false
* @package Civi\Api4
*/
class SavedSearch extends Generic\DAOEntity {
* Used to read/write persistent setting data from CiviCRM.
*
* @see \Civi\Core\SettingsBag
+ * @searchable false
* @package Civi\Api4
*/
class Setting extends Generic\AbstractEntity {
*
* For setting "hush" preferences for system check alerts.
*
+ * @searchable false
* @package Civi\Api4
*/
class StatusPreference extends Generic\DAOEntity {
* UFField entity - aka profile fields.
*
* @see \Civi\Api4\UFGroup
+ * @searchable false
* @package Civi\Api4
*/
class UFField extends Generic\DAOEntity {
* UFGroup entity - AKA profiles.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/profiles/
+ * @searchable false
* @package Civi\Api4
*/
class UFGroup extends Generic\DAOEntity {
* UFJoin entity - links profiles to the components/extensions they are used for.
*
* @see \Civi\Api4\UFGroup
+ * @searchable false
* @package Civi\Api4
*/
class UFJoin extends Generic\DAOEntity {
/**
* UFMatch entity - links civicrm contacts with users created externally
*
+ * @searchable false
* @package Civi\Api4
*/
class UFMatch extends Generic\DAOEntity {
elseif ($key == 'throws' || $key == 'see') {
$info[$key][] = implode(' ', $words);
}
+ elseif ($key == 'searchable') {
+ $info[$key] = strtolower($words[0]) !== 'false';
+ }
elseif ($key == 'param' && $words) {
$type = $words[0][0] !== '$' ? explode('|', array_shift($words)) : NULL;
$param = rtrim(array_shift($words), '-:()/');
* The `prefill` and `submit` actions are used for preparing forms and processing submissions.
*
* @see https://lab.civicrm.org/extensions/afform
+ * @searchable false
* @package Civi\Api4
*/
class Afform extends Generic\AbstractEntity {
/**
* Class AfformPalette
+ * @searchable false
* @package Civi\Api4
*/
class AfformPalette extends Generic\AbstractEntity {
/**
* Class AfformTag
+ * @searchable false
* @package Civi\Api4
*/
class AfformTag extends Generic\AbstractEntity {
*
* Provided by the Search Kit extension.
*
+ * @searchable false
* @package Civi\Api4
*/
class SearchDisplay extends Generic\DAOEntity {
$schema = [];
$entities = \Civi\Api4\Entity::get()
->addSelect('name', 'title', 'type', 'title_plural', 'description', 'icon', 'paths')
- ->addWhere('name', '!=', 'Entity')
+ ->addWhere('searchable', '=', TRUE)
->addOrderBy('title_plural')
->setChain([
'get' => ['$name', 'getActions', ['where' => [['name', '=', 'get']]], ['params']],