Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Multiple instances #7

Closed
rubenheymans opened this issue Jul 10, 2014 · 6 comments
Closed

Multiple instances #7

rubenheymans opened this issue Jul 10, 2014 · 6 comments
Labels

Comments

@rubenheymans
Copy link

How can I add multiple ckeditor instances on one page?

@tonydspaniard
Copy link
Member

Yes... you should be able to

@rubenheymans
Copy link
Author

I guess I should use different id's, how can I do this with this code: (different id for each language)

field($model, 'content')->widget(CKEditor::className(), [ 'options' => ['rows' => 20, 'name' => "{$language}[PageLang][content]"], 'preset' => 'standard', ]); ?>

@tonydspaniard
Copy link
Member

@hashie5 when you add a model, the unique_id is created from the active id of the model name + attribute name. But if you wish to attach your own ids, then you have to set the 'options' => ['id'=>...

@rubenheymans
Copy link
Author

I added the id on the same level as the 'options' and 'preset', got it now, thanks

field($model, 'content')->widget(CKEditor::className(), [ 'options' => [ 'rows' => 20, 'name' => "{$language}[PageLang][content]", 'id' => "{$language}[PageLang][content]", ], 'preset' => 'standard', ]); ?>

@tonydspaniard
Copy link
Member

Glad you fix it...

Best

@rubenheymans
Copy link
Author

I would also like to add 'labelOptions' => ['class' => '...'],
found it here: http://stuff.cebe.cc/yii2docs/yii-widgets-activefield.html#$labelOptions-detail
where do I add this code?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants