Is it possible to rewrite protected method like this in helpers?

class Fishpig_Wordpress_Helper_Filter extends Fishpig_Wordpress_Helper_Abstract
    protected function _applyShortcodes(&$content, $object, $context) {
  • 1
    No, it breaks oop concept then. – Manikandan Arunachalam Dec 3 '14 at 7:33
  • Iam not sure this works but once have a try by looking at this link1 and link2advice to maintain a backup. – dh47 Dec 3 '14 at 7:49
  • oh sorry.protected method can accessed by inherited class. – Manikandan Arunachalam Dec 3 '14 at 8:18

If you're creating a subclass of Fishpig_Wordpress_Helper_Filter, yes - the subclass can override a protected method http://php.net/manual/en/language.oop5.visibility.php

  • that was i thought. thx – Doni Wibowo Dec 3 '14 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.