K, below is mine solution to add editable window with ckeditor to customfield plugin.
1. copy and paste below code to customfields.php in createTagInputs() function.
I recommend to add it in line 131 or 136
You can add your own buttons to toolbar if you need them.
2. add to data/other/customfields.xml new item with textarea type
example
3. edit /admin/edit.php
in line 245 delete: class="set-example-text"
delete line 281: <script type="text/javascript" src="template/js/ckeditor/ckeditor.js"></script>
You have to do this, otherwise both ckeditor instances will interfere with each other and won't work correctly.
4. edit admin/template/js/ckeditor/config.js and add 2 directives:
note: above options disable showing currently edited element inside ckeditor.
5. call the textarea content as described by Mike in installation notes
known "bugs":
- customfield's ckeditor seems not to use getsimple skin, so it doesn't look like getsimple's ckeditor instance. I have no more willingness to mess with it. If there's a simple way to make it use getsimple's skin, I'll gladly see a hint
- simple image gallery won't work inside content added using this plugin. It's a matter of SIG plugin, not customfields.
have fun
1. copy and paste below code to customfields.php in createTagInputs() function.
I recommend to add it in line 131 or 136
Code:
// draw a textarea window
case "textarea":
echo "<td colspan='2'>";
echo "<script type=\"text/javascript\" src=\"../admin/template/js/ckeditor/ckeditor.js\"></script>".PHP_EOL;
echo "<b>".$tags[$key]['label'].":</b><br />".PHP_EOL;
echo "<textarea id=\"post-".strtolower($key)."\" name=\"post-".strtolower($key)."\" >";
echo stripslashes($data_edit->$key);
echo "</textarea></td>".PHP_EOL;
echo "<script type=\"text/javascript\">
CKEDITOR.replace( 'post-".strtolower($key)."',{
skin : 'getsimple',
forcePasteAsPlainText : true,
entities : true,
uiColor : '#ECECEC',
toolbar : [['Bold', 'Italic', 'Underline', 'NumberedList', 'BulletedList', 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','Outdent','Indent', 'TextColor','Link', 'Unlink', 'Image'] , '/', ['Format', 'FontSize','RemoveFormat', 'Source']]
});
</script>";
break;
You can add your own buttons to toolbar if you need them.
2. add to data/other/customfields.xml new item with textarea type
example
Code:
<item>
<desc>textareacontent</desc>
<label>Editable content</label>
<type>textarea</type>
</item>
3. edit /admin/edit.php
in line 245 delete: class="set-example-text"
delete line 281: <script type="text/javascript" src="template/js/ckeditor/ckeditor.js"></script>
You have to do this, otherwise both ckeditor instances will interfere with each other and won't work correctly.
4. edit admin/template/js/ckeditor/config.js and add 2 directives:
Code:
config.removePlugins = 'elementspath';
config.resize_enabled = false;
note: above options disable showing currently edited element inside ckeditor.
5. call the textarea content as described by Mike in installation notes
Code:
getCustomField('textareacontent');
known "bugs":
- customfield's ckeditor seems not to use getsimple skin, so it doesn't look like getsimple's ckeditor instance. I have no more willingness to mess with it. If there's a simple way to make it use getsimple's skin, I'll gladly see a hint
- simple image gallery won't work inside content added using this plugin. It's a matter of SIG plugin, not customfields.
have fun
Addons: blue business theme, Online Visitors, Notepad