Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions administrator/language/en-GB/plg_editors_tinymce.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ PLG_TINY_FIELD_ADVLIST_LABEL="Advanced List"
PLG_TINY_FIELD_CONTEXTMENU_LABEL="Context Menu"
PLG_TINY_FIELD_CSS_DESC="By default the Plugin looks for an editor.css file. If it can't find one in the default template CSS folder, it loads the editor.css file from the system template."
PLG_TINY_FIELD_CSS_LABEL="Template CSS Classes"
PLG_TINY_FIELD_CUSTOM_CONTENT_TEMPLATE_PATH_DESC="A directory named \"tinymce\" in your site template."
PLG_TINY_FIELD_CUSTOM_CONTENT_TEMPLATE_PATH_LABEL="Content Template Directory"
PLG_TINY_FIELD_CUSTOM_CSS_DESC="Optional CSS file that will override the standard editor.css file. Enter a file name to point to a file in the CSS folder of the default template (for example, templates/cassiopeia/css/). Or enter a full URL path to the custom CSS file. If you enter a value in this field, this file will be used instead of the editor.css file."
PLG_TINY_FIELD_CUSTOM_CSS_LABEL="Custom CSS Classes"
PLG_TINY_FIELD_CUSTOM_PATH_LABEL="Images Directory"
Expand Down
15 changes: 13 additions & 2 deletions plugins/editors/tinymce/forms/setoptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@
showon="drag_drop:1"
/>

<field
name="content_template_path"
type="folderlist"
label="PLG_TINY_FIELD_CUSTOM_CONTENT_TEMPLATE_PATH_LABEL"
description="PLG_TINY_FIELD_CUSTOM_CONTENT_TEMPLATE_PATH_DESC"
directory="/templates"
hide_none="true"
recursive="true"
exclude="system"
default=""
folderFilter="^tinymce"
/>

<field
name="entity_encoding"
type="list"
Expand Down Expand Up @@ -293,7 +306,6 @@
label="PLG_TINY_FIELD_CUSTOMBUTTON_LABEL"
/>


<field
name="external_plugins"
type="subform"
Expand Down Expand Up @@ -321,5 +333,4 @@
</field>

</fieldset>

</form>
47 changes: 28 additions & 19 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,32 +470,41 @@ public function onDisplay(

if (!empty($allButtons['template']))
{
foreach (glob(JPATH_ROOT . '/media/vendor/tinymce/templates/*.html') as $filename)
// Do we have a custom content_template_path
$template_path = $levelParams->get('content_template_path');
$template_path = $template_path ? '/templates/' . $template_path : '/media/vendor/tinymce/templates';

foreach (glob(JPATH_ROOT . $template_path . '/*.{html,txt}', GLOB_BRACE) as $filepath)
{
$filename = basename($filename, '.html');
$fileinfo = pathinfo($filepath);
$filename = $fileinfo['filename'];
$full_filename = $fileinfo['basename'];

if ($filename !== 'index')
if ($filename === 'index')
{
$lang = Factory::getLanguage();
$title = $filename;
$description = ' ';
continue;
}

if ($lang->hasKey('PLG_TINY_TEMPLATE_' . strtoupper($filename) . '_TITLE'))
{
$title = Text::_('PLG_TINY_TEMPLATE_' . strtoupper($filename) . '_TITLE');
}
$lang = Factory::getLanguage();
$title = $filename;
$title_upper = strtoupper($filename);
$description = ' ';

if ($lang->hasKey('PLG_TINY_TEMPLATE_' . strtoupper($filename) . '_DESC'))
{
$description = Text::_('PLG_TINY_TEMPLATE_' . strtoupper($filename) . '_DESC');
}
if ($lang->hasKey('PLG_TINY_TEMPLATE_' . $title_upper . '_TITLE'))
{
$title = Text::_('PLG_TINY_TEMPLATE_' . $title_upper . '_TITLE');
}

$templates[] = array(
'title' => $title,
'description' => $description,
'url' => Uri::root(true) . '/media/vendor/tinymce/templates/' . $filename . '.html',
);
if ($lang->hasKey('PLG_TINY_TEMPLATE_' . $title_upper . '_DESC'))
{
$description = Text::_('PLG_TINY_TEMPLATE_' . $title_upper . '_DESC');
}

$templates[] = array(
'title' => $title,
'description' => $description,
'url' => Uri::root(true) . $template_path . '/' . $full_filename,
);
}
}

Expand Down
1 change: 1 addition & 0 deletions templates/cassiopeia/html/tinymce/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
1 change: 1 addition & 0 deletions templates/cassiopeia/templateDetails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<filename>template_thumbnail.png</filename>
<folder>css</folder>
<folder>html</folder>
<folder>html/tinymce</folder>
<folder>images</folder>
<folder>js</folder>
<folder>scss</folder>
Expand Down