Once you start manipulating content items with JCckContent, you'll be using it more and more, and you'll come up with the need of:
- extending current objects (and methods)
- reusing code
and that's what we'll be learning with this manual!
Extend a JCckContent instance
Depending on the needs, you'll be able to choose from one of the following scope:
- 'instance' [default] — new callables will only be available for the current instance.
- 'type' — new callables will be available for any instance of a specific content type.
- 'object' — new callables will be available for any instance of a specific object.
- 'global' — new callables will be available for any instance of any object.
$content->extend( __DIR__.'/extend/mixin.php' ); @ SEBLOD 3.18.0
New callables will only be available for the current instance.
$content->extend( __DIR__.'/extend/mixin.php', 'global' ); @ SEBLOD 3.18.0
New callables will be available for any instance of any object.
$content->load( ... );
$content->extend( __DIR__.'/extend/mixin.php', 'object' ); @ SEBLOD 3.18.0
New callables will be available for any instance of a specific object. (i.e. for any instance using the same object as the item loaded.)
$content->load( ... );
$content->extend( __DIR__.'/extend/mixin.php', 'type' ); @ SEBLOD 3.18.0
New callables will be available for any instance of a specific content type. (i.e. for any instance using the same content type as the item loaded.)
Example to get the ICS output of multiple Events
process.php:
mixin.php:
Output: