alleyinteractive / alleyinteractive/elasticsearch-extensions

Standardize hook callbacks

Ouverte
#63 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement php
Langage dominant
PHP
Étoiles
5
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Description

the vip search adapter [uses a `filter__*` namespacing for filter callbacks](https://github.com/alleyinteractive/elasticsearch-extensions/blob/0fe5055a0b1303d7d7ed94306966ce08bad7b821/lib/adapters/class-vip-enterprise-search.php#L569-L579), but the SearchPress adapter [uses a different approach](https://github.com/alleyinteractive/elasticsearch-extensions/blob/0fe5055a0b1303d7d7ed94306966ce08bad7b821/lib/adapters/class-searchpress.php#L483-L492) that names the callbacks according to their purpose (rather than naming according to the hook that they hook into).

For readability, maintainability, and consistency across adapters these hooks and callbacks should be standardized. I would propose that the callbacks use the [`filter__*` namespacing convention for filter callbacks](https://github.com/alleyinteractive/elasticsearch-extensions/blob/0fe5055a0b1303d7d7ed94306966ce08bad7b821/lib/adapters/class-vip-enterprise-search.php#L569-L579), but within the callbacks there are only function calls and minimal logic (opposed to all of the logic for each feature that uses the hook). By abstracting the feature functionality from the callbacks, we get the best of both worlds: we get the connective clarity offered by the `filter__*`/`action__*` convention, and we get the functional clarity offered by the approach that the SearchPress adapter is currently taking.

### Use Case

When a developer is building a new feature that exists across adapters, the approach to using hooks should be consistent between the adapters.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.