alleyinteractive / alleyinteractive/elasticsearch-extensions
Standardize hook callbacks
- Ngôn ngữ chính
- PHP
- Star
- 5
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 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.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.