HOW to extend (override) ApPHP framework helper classes?

Discuss everything related to ApPHP Durecty CMF. All versions. Any questions related to the Directy CMF developing or using should be posted to this forum.

Moderators: alexandrleonenko, alexmst

administrator
Site Admin
Site Admin
Posts: 6169
Joined: Jan 7th, '09, 23:18
Contact:

HOW to extend (override) ApPHP framework helper classes?

Postby administrator » Mar 5th, '15, 16:32

To override ApPHP framework helper classes you have to do following:

  • Create directory named helpers in protected/ directory of your application.
  • Copy into this directory a required helper class from the framework directory.
  • Change the code of this class according to yuor needs: rewrite, change or add methods.

There is also another solution (recommended):

  • Create directory named helpers in protected/ directory of your application.
  • Copy into this directory a required helper class from the framework directory.
  • Rename an original helper class in directory helpers of yuor application without prefix "C", for example: CHtml > Html.
  • Create an empty class with original helper name and extend it from the class created on the previous step.
  • In the new class override only the method you need. When new update of ApPHP framework will be released simply replace the code of the class created on step 3.
  • Add to extended class constructor with parent::__construct();
  • Before call of extended file - create an object of such class type and then use it.

Untitled.png
Untitled.png (15.86 KiB) Viewed 2094 times

Return to “ApPHP Directy CMF {developers/users}”