themeplate / hook
Advanced wrapper for filters
v1.0.0
2023-02-24 13:09 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
Requires (Dev)
- themeplate/tester: ^2.0
README
Usage
use ThemePlate\Hook; // Hook::<ACTION>( <TAG>, <VALUE> ) Hook::append( 'sample_filter', 'ing' ); Hook::prepend( 'sample_filter', 're-' ); Hook::return( 'sample_filter', 'this!' ); Hook::pluck( 'sample_filter', 'i' ); Hook::replace( 'sample_filter', '!', '...' ); Hook::insert( 'sample_filter', 'u', 2 ); Hook::once( 'sample_filter', array( 'pluck', 'th' ) );
^Line by line output with initial value test
// apply_filters( <TAG>, <INITIAL> ); apply_filters( 'sample_filter', 'test' ); // <RESULT #1> apply_filters( 'sample_filter', 'test' ); // <RESULT #2>