choppingblock Posted May 29, 2014 Share Posted May 29, 2014 I think most of us know that the wysiwig editors can be a pain if you want to input more than just some paragraphs... e.g. if you have to work with nested divs in the body of a page. So for some pages, the editor is best left switched off. Only solution i can think of at the moment is to create a new template, a new field for body content without editor, and assign the template to the page. Works, but is cumbersome. It would be extremely helpful if we could switch the editor on and off via field context settings. What do you think? Is this even possible? Link to comment Share on other sites More sharing options...
Nico Knoll Posted May 29, 2014 Share Posted May 29, 2014 My solution would be: 1. create a new field called "use_wysiwyg" and choose "checkbox" as type 2. create a field "body_raw" or whatever you want to call the body field without wysiwyg 3. Add both fields to your template and save it Now let the processwire magic play: 4. Now click on "body" And go to Visibility -> Show this field only if... and add the following: 5. Do the same thing with "body_raw". Only difference: "use_wysiwyg=0" Now the wysiwyg editor should only appear if the checkbox is checked. In your template do this to get the content: $page->get('body|body_raw'); 6 Link to comment Share on other sites More sharing options...
Macrura Posted May 29, 2014 Share Posted May 29, 2014 (edited) @nico - good solution, only issue is what if the editor enters some stuff in the wysiwyg, and then later decides to switch to raw; the pipe wouldn't work right, so maybe instead use the checkbox to determine which to show on output? echo $page->use_wysiwyg==0 ? $page->body_raw : $page->body; Edited May 29, 2014 by Macrura 3 Link to comment Share on other sites More sharing options...
kongondo Posted May 29, 2014 Share Posted May 29, 2014 @nico - good solution, only issue is what if the editor enters some stuff in the wysiwyg, and then later decides to switch to raw; the pipe wouldn't work right, so maybe instead use the checkbox to determine which to show on output? echo $page->use_wysiwyg=0 ? $page->body_raw : $page->body; Missing an =? ($page->use_wysiwyg==0) 1 Link to comment Share on other sites More sharing options...
Macrura Posted May 29, 2014 Share Posted May 29, 2014 thanks @kongondo...fixed in post Link to comment Share on other sites More sharing options...
choppingblock Posted May 29, 2014 Author Share Posted May 29, 2014 There ara probably many different ways to achieve the result (nice solution though)... It's just a matter of convenience. 1 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