Skip to content
Snippets Groups Projects

added method: get_hookable_instance_by_class_name

Merged Krzysztof Dyszczyk requested to merge feature/get-hookable into master
1 file
+ 16
0
Compare changes
  • Side-by-side
  • Inline
+ 16
0
@@ -23,6 +23,22 @@ trait HookableParent {
$this->hookable_objects[] = $hookable_object;
}
/**
* Get hookable instance.
*
* @param string $class_name Class name.
*
* @return false|Hookable
*/
public function get_hookable_instance_by_class_name( $class_name ) {
foreach ( $this->hookable_objects as $hookable_object ) {
if ( $hookable_object instanceof $class_name ) {
return $hookable_object;
}
}
return false;
}
/**
* Run hooks method on all hookable objects.
*/
Loading