This is a common design pattern, and I would have solved it in the same way you did. Let My_WP_List_Class
extend WP_List_Class
, and pass a “configuration” object to it. You could even make the relation more explicit by defining an interface your configuration object must adhere to:
interface My_WP_List_Configuration
{
public function get_name();
public function get_admin_page_uri();
// ...
}
class WPSE10402_Plugin extends Wyrfel_Plugin implements My_WP_List_Configuration
{
public function get_name()
{
return $this->_name;
}
public function get_admin_page_uri()
{
// ...
}
}
I don’t see much difference with the current way of using actions to hook your functionality into. Yes, your code is now structured in a class instead of in a list of functions, but that is the only difference, no?