Closed Holt59 closed 7 years ago
When is this exception thrown? Could you show me the code where you load the helpers?
I have changed the names of the helpers in v3.2.1 (Bootstrap.BootstrapHtmlHelper
-> Bootstrap.HtmlHelper
), but the old names are still there for compatibility so this should not be an issue...
I cannot reproduce the error with a fresh CakePHP 3.4.0 install with v3.2.1.
After a bit of testing, this seems to happens if you load the Bootstrap.HtmlHelper
twice, but with different configs, e.g.:
// In your AppController
public $helpers = [
'Html' => [
'className' => 'Bootstrap.BootstrapHtml'
]
];
// In your AppView
public function initialize() {
$this->loadHelper('Html', [
'className' => 'Bootstrap.Html'
]);
}
I don't think it is directly related to the helpers... Did you modify anything related to the names of the helpers?
I did not modify any of the settings, I think it must be releated to one of your last changes... I'll look into this tomorrow.
I just load the helper once in the AppController, but maybe I'm doing something strange there...
Am 16.02.2017 um 21:53 schrieb Mikaël Capelle:
When is this exception thrown? Could you show me the code where you load the helpers?
I have changed the names of the helpers in v3.2.1 (|Bootstrap.BootstrapHtmlHelper| -> |Bootstrap.HtmlHelper|), but the old names are still there for compatibility so this should not be an issue...
I cannot reproduce the error with a fresh CakePHP 3.4.0 install with v3.2.1.
After a bit of testing, this seems to happens if you load the |Bootstrap.HtmlHelper| twice, but with different configs, e.g.:
// In your AppController public $helpers = [ 'Html' => [ 'className' => 'Bootstrap.BootstrapHtml' ] ];
// In your AppView public function initialize() { $this->loadHelper('Html', [ 'className' => 'Bootstrap.Html' ]); }
I don't think it is directly related to the helpers... Did you modify anything related to the names of the helpers?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Holt59/cakephp3-bootstrap-helpers/issues/109#issuecomment-280456767, or mute the thread https://github.com/notifications/unsubscribe-auth/AGdQVwoCZxNk4a5vIr_bWz10m71-8xekks5rdLc_gaJpZM4MDh4B.
Could you:
Bootstrap.Html
?This is how I load the helpers in my AppController
:
public $helpers = [
'Html' => [
'className' => 'Bootstrap.BootstrapHtml'
],
'Form' => [
'className' => 'Bootstrap.BootstrapForm',
'widgets' => [
'datePicker' => ['DatePicker', '_view'],
'static' => ['StaticControl'],
],
'templates' => [
'staticControl' => '<p class="form-control-static">{{value}}</p>',
],
'columns' => [
'label' => 2,
'input' => 6,
'error' => 4
]
]
];
Stacktrace:
⟩ Cake\View\Helper\FormHelper->postLink
⟩ Cake\View\Helper->__get
⟩ Cake\View\View->loadHelper
⟩ Cake\Core\ObjectRegistry->load
⟩ Cake\Core\ObjectRegistry->_checkDuplicate
This line seems to be the problem:
$out .= $this->Html->link($title, $url, $options);
The error is throw at FormHelper::postLink
, which seems to be the first call to the FormHelper which is not overridden by the Plugin. The same error is triggered by calling Paginator::numbers()
, even though this method is overridden by the plugin...
The problem is fixed by changing all helper names to the new version (without "Bootstrap").
I see where the problem comes from, actually it also happens if you load the standard Html
helper together with the Bootstrap ones.
The helpers used internally be other helpers (the Form
helper here) are synchronized with the helpers used by the view. Since the Form
helpers is using Bootstrap.Html
internally, there is a conflict if you use Bootstrap.BootstrapHtml
or Html
(the standard Cake helper) for your view.
This is something that also happens with 3.1.0 if you use the standard CakePHP helper, so I will try to fix this.
This should be fixed by f4e5bd66c71a62323974fd9a0ebfaf4b125c0edb.
Note: The helpers are now linked to the helpers used by the view, so some restrictions apply:
Html
helper set up for the view must be Bootstrap.Html
in order to use the easy-icon feature;searchForm()
and button()
methods of the navbar helper will not work as expected if the Form
helper set for the view is not Bootstrap.Form
.I will add these notes to the documentation as soon as possible.
I am closing this since this should be fixed by now, feel free to (re-)open if you still have troubles!
Issue from #107
@nrother
dev-master
has currently set CakePHP < 3.4.0 as a requirement. Using v.3.2.1.x-dev throws an exception: