php - My SilverStripe module overrides other modules display -
i'm writing subscribe module plugin silverstripe blog module. far have yml as:
--- name: subscription after: 'framework/*','cms/*' --- blog: extensions: - subscription page_controller: extensions: - subscriptionwidget
and subscriptionwidget.php:
<?php class subscriptionwidget extends dataextension { public function subscriptionwidget() { $controller = subscriptionwidget_controller::create(); $form = $controller->subscriptionwidget(); return $form; } } class subscriptionwidget_controller extends controller { private static $allowed_actions = array('subscriptionwidget'); public function subscriptionwidget () { $form = form::create( $this, __function__, fieldlist::create( textfield::create('email', 'email'), textfield::create('name', 'name') ), fieldlist::create( formaction::create('submit', 'subscribe') ) );//->settemplate('subscriptionwidget'); return $form; } public function submit($data, $form) { return $this->redirect('/subscribed'); } }
at moment works intended plugin use called betternavigator disappears screen. if take out
page_controller: extensions: - subscriptionwidget
from yml reappears. i've looked through both code bases quite simple , there no conflicting functions. i've tried using contentcontroller
instead of page_controller
, template disappears until disable betternavigator , reappears. have 1 or 2 pretty empty classes called variation of subscriber while there 1 function in betternavigator called betternavigator.
why happening?
i see 1 clash in code results in incorrect runtime behaviour. method subscriptionwidget::subscriptionwidget()
treated legacy class constructor. suggest thinking better class , method names.
class subscriptionwidget extends extension { // explicitly defined constructor public function __construct() { parent::__construct(); } // 1 normal function public function subscriptionwidget() { $controller = subscriptionwidget_controller::create(); $form = $controller->subscriptionwidget(); return $form; } }
Comments
Post a Comment