jQuery code snippet:
$(".sample-edit").cms_edit({ // cms edit plugin
cms_path: skin_cms_path, // cms folder relative path
admin: ['admin','demo'], // show control when logged such users
class_control: "sample-edit-control", // edit control button class
files: skin_files // page include files array
});
HTML code snippet:
<fieldset class="cms-form-fieldset">
<legend class="cms-form-legend">Add editor control into page sample</legend>
<div class="sample-edit" data-file="0">There is sample edit control: </div>
<!-- data-file="0" to set index=0 in files array - see snippets below -->
</fieldset>
CSS code snippet:
.sample-edit { /* element where add control button */
position: relative;
display: block;
float: left
}
.sample-edit-control { /* edit control button */
position: relative;
display: inline;
float: right;
width: 24px;
height: 24px;
background: url('/skin/images/page-white-edit-icon.png') no-repeat center center
}
.sample-edit-control a { /* anchor of edit control button */
position: absolute;
display: block;
width: 24px;
height: 24px
}
Template code snippet:
<script type="text/javascript">
var skin_files = JSON.parse('{json_encode($file_obj)}');
var skin_cms_path = "{$cms_path}";
</script>
.cms_edit()
Option | Method | Callback |
---|---|---|
cms_path, class_control, file_no_attr | ||
admin, grp, files | ||
control, cms |
.cms_edit( settings )
|
|||||||
|
cms_edit plugin styling and control: