Object Manager¶
Constructors¶
- ObjectManager(interest_list)¶
Constructs a new object manager.
Combines
wp_object_manager_new()
andwp_object_manager_add_interest_full()
- Parameters
interest_list (table) – a list of interests to objects
- Returns
a new object manager
- Return type
ObjectManager
Methods¶
- ObjectManager.activate(self)¶
Activates the object manager. Binds
wp_core_install_object_manager()
.- Parameters
self – the object manager
- ObjectManager.get_n_objects(self)¶
- Parameters
self – the object manager
- Returns
the number of objects managed by the object manager
- Return type
integer
- ObjectManager.iterate(self, interest)¶
Binds
wp_object_manager_new_filtered_iterator_full()
- Parameters
self – the object manager
interest (ObjectInterest) – an interest to filter objects, or nil
- Returns
all the managed objects that match the interest
- Return type
Iterator; the iteration items are of type GObject
- ObjectManager.lookup(self, interest)¶
Binds
wp_object_manager_lookup()
- Parameters
self – the object manager
interest (ObjectInterest) – the interest to use for the lookup, or nil
- Returns
the first managed object that matches the interest
- Return type