ohthanks Posted February 4, 2013 Share Posted February 4, 2013 Is there a way to edit the config for all of my existing textareas that are using tinymce or do I need to go in and do my changes in each fields' input settings tab? Thanks! Link to comment Share on other sites More sharing options...
JeffS Posted February 5, 2013 Share Posted February 5, 2013 Welcome to the forums. You could modify the attributes of the /ProcessWire/wire/modules/Inputfield/InputfieldTinyMCE/InputfieldTinyMCE.module in the core, but your modifications would be overwritten on subsequent updates of Processwire. The better choice would be to copy the InputfieldTinyMCE module to /sites/modules and update the name of the directory as well as edit the InputfieldTinyMCE.module. Then use your new new input field with the new settings. Or add the changes in each fields' input settings tab.. Link to comment Share on other sites More sharing options...
ohthanks Posted February 5, 2013 Author Share Posted February 5, 2013 That makes sense, I looked at editing the main module file but it seemed like it only would apply to newly created instances of the field. Which is fine as along as I know ahead of time. Setting it up as a new site module is great idea, thanks! Link to comment Share on other sites More sharing options...
Soma Posted February 5, 2013 Share Posted February 5, 2013 Just wonder how many tinymce fields you got? I isually need 2-3 max for a complex site. And theyre different in config anyway. If theyre not you're doing something wrong. Copy InputfieldTinyMCE would be possible but can be cumbersome as you need to maintain it for yourself. If its for thing like theme settings you can overwrite it in the admin template for all tinymces with a little js extending the config var. 1 Link to comment Share on other sites More sharing options...
Soma Posted February 5, 2013 Share Posted February 5, 2013 If you want you can create a bootstrap, or in a template, and use API to change all TinyMCE fields settings. Example: include('./index.php'); $fields = wire("fields")->find("name*=tinymce_"); foreach($fields as $field) { $field->theme_advanced_buttons3 = "table|bold"; $field->custom = "theme:advanced"; $field->thirdparty = "bramus: /site/tinymce/bramus_cssextras"; $field->save(); } 2 Link to comment Share on other sites More sharing options...
ryan Posted February 5, 2013 Share Posted February 5, 2013 Some great suggestions from the guys above. But the reality is that unless you've got a whole lot of TinyMCE fields, the least time consuming thing to do would just be to edit the fields individually and update for whatever settings you want. Keep a window open with your original copy so you can copy/paste between them. Another thing is that if all these textarea/tinymce fields really do share the same settings, why have so many? Unless they are all being used on the same template, you'd derive more benefit by reusing the same field on all the templates where you need the same TinyMCE settings. Soma is right that it's pretty unusual to have more than 1-3 TinyMCE fields total, even a large site. Link to comment Share on other sites More sharing options...
ohthanks Posted February 12, 2013 Author Share Posted February 12, 2013 This helped a lot, thanks. I consolidated some of my textareas and got plugins etc setup for each of the fields, works exactly like I wanted now. Link to comment Share on other sites More sharing options...
thetuningspoon Posted April 25, 2013 Share Posted April 25, 2013 Love your idea, Soma. I created a php file in the root of my site called tinymce.php which I can edit and then simply load in the browser www.mysite.com/tinymce.php to send all of the changes to all my tinyMCE fields. Here's my code for anyone who might be confused by this: <?php include('./index.php'); $fields = wire("fields")->find("name=body|sidebar|introduction|affiliates"); foreach($fields as $field) { $field->theme_advanced_buttons1 = "formatselect,|,styleselect,styleprops,|,fontsizeselect,forecolor,|,bold,italic,underline,strikethrough,|,hr,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,indent,outdent,nonbreaking"; $field->theme_advanced_buttons2 = "undo,redo,|,tablecontrols,|,pastetext,|,link,unlink,anchor,|,image,|,replace,|,removeformat,|,code,|,fullscreen"; $field->theme_advanced_buttons3 = ""; $field->theme_advanced_blockformats = "p,h2,h3,h4"; $field->plugins = "inlinepopups,safari,media,paste,fullscreen,table,nonbreaking,searchreplace,style"; $field->valid_elements = "*[*]"; $field->content_css = "/site/templates/styles/content.css"; $field->custom = "theme_advanced_styles:Test Style=test paste_text_sticky:true"; $field->thirdparty = ""; $field->save(); } The name=body|sidebar|introduction|affiliates line selects all of my tinymce fields by name (Soma's example assumed that your tinymce fields all had tinymce_ prefixes on them, which mine do not, so I am just listing all of them out instead). It then loops through each matching field and updates each setting. Pretty cool! 4 Link to comment Share on other sites More sharing options...
thetuningspoon Posted May 17, 2013 Share Posted May 17, 2013 NOTE: Here is an updated/more advanced version of the script I posted below. And here's one for updating the CKEditor, if you're using that instead of tinyMCE: <?php include('./index.php'); $fields = wire("fields")->find("name=body|intro|sidebar"); foreach($fields as $field) { $field->toolbar = " Format, Bold, Italic, -, RemoveFormat NumberedList, BulletedList, -, Blockquote PWLink, Unlink PWImage, Table, HorizontalRule, SpecialChar PasteText, PasteFromWord Scayt, -, Sourcedialog "; $field->inlineMode = "0"; $field->contentsCss = "/site/templates/styles/contents.css"; $field->stylesSet = ""; $field->extraPlugins = "pwimage,pwlink,sourcedialog"; $field->removePlugins = "image,link"; $field->save(); } ?> CKEditor is now updated. 1 Link to comment Share on other sites More sharing options...
ADONIS Posted December 27, 2013 Share Posted December 27, 2013 Love your idea, Soma. I created a php file in the root of my site called tinymce.php which I can edit and then simply load in the browser www.mysite.com/tinymce.php to send all of the changes to all my tinyMCE fields. Here's my code for anyone who might be confused by this: <?php include('./index.php'); $fields = wire("fields")->find("name=body|sidebar|introduction|affiliates"); foreach($fields as $field) { $field->theme_advanced_buttons1 = "formatselect,|,styleselect,styleprops,|,fontsizeselect,forecolor,|,bold,italic,underline,strikethrough,|,hr,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,indent,outdent,nonbreaking"; $field->theme_advanced_buttons2 = "undo,redo,|,tablecontrols,|,pastetext,|,link,unlink,anchor,|,image,|,replace,|,removeformat,|,code,|,fullscreen"; $field->theme_advanced_buttons3 = ""; $field->theme_advanced_blockformats = "p,h2,h3,h4"; $field->plugins = "inlinepopups,safari,media,paste,fullscreen,table,nonbreaking,searchreplace,style"; $field->valid_elements = "*[*]"; $field->content_css = "/site/templates/styles/content.css"; $field->custom = "theme_advanced_styles:Test Style=test paste_text_sticky:true"; $field->thirdparty = ""; $field->save(); } The name=body|sidebar|introduction|affiliates line selects all of my tinymce fields by name (Soma's example assumed that your tinymce fields all had tinymce_ prefixes on them, which mine do not, so I am just listing all of them out instead). It then loops through each matching field and updates each setting. Pretty cool! Hi, I did the same step. I make the tinymce.php file and I place it on the root of my files in my case is XAMPP. I run the site localhost/mysite/tinymce.php but I still see the same bar without the more functons. I think there is something I doing wrong. Do I have to edit and/or add another file in order to achive the same result as yours? Can you please help? thanx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now