WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 19.09.2021 21:10:35

losttrip
Member

CKEditor Dev Edition - WBCE Links - include OFA item pages

WBCE Version: 1.5.0
PHP Version: 7.4.22
CKEditor Developer Edition 4.16.1
OneForAll 1.1.6

I am curious if it is possible to include OFA item pages in the WBCE Link drop down within CKEditor Dev Edition.  Or is the page level as far as WBCE Links can show?

I'm not asking anyone to develop this, I am just wondering if there is a setting somewhere to make this deeper linking possible?

Offline

#2 20.09.2021 08:11:00

florian
Administrator

Re: CKEditor Dev Edition - WBCE Links - include OFA item pages

It is possible, you do not even need the CKE Dev edition.

Edit /modules/ckeditor/ckeditor/plugins/wblink/pages.php

After

$ModuleList = "var ModuleList = new Array();";

add

$OneForAllSections = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE module = 'oneforall'");
while ($section = $OneForAllSections->fetchRow()) {
    $OneForAll = $database->query("SELECT `item_id`, `title`, `link` FROM ".TABLE_PREFIX."mod_oneforall_items WHERE `active`=1 AND `section_id`=".$section['section_id']." ORDER BY `link` ASC");	
    $ModuleList .= "ModuleList[".$section['page_id']."] = 'OneForAll';";
    $NewsItemsSelectBox .= "NewsItemsSelectBox[".$section['page_id']."] = new Array();";
    while ($OneForAll && $item = $OneForAll->fetchRow()) {
		$OfAPages =	$database->query("SELECT `link` FROM ".TABLE_PREFIX."pages WHERE `page_id`=".$section['page_id']);
		while ($OfAPages && $OfAItemPage = $OfAPages->fetchRow()) {			 
			$item['title'] = preg_replace($wblink_allowed_chars, "", $item['title']);
			$NewsItemsSelectBox .= "NewsItemsSelectBox[".$section['page_id']."][NewsItemsSelectBox[".$section['page_id']."].length] = new Array('".(addslashes($item['title']))."', '".WB_URL.PAGES_DIRECTORY.$OfAItemPage['link'].(addslashes($item['link'])).PAGE_EXTENSION."');";
		}
    }
}

Edit /modules/ckeditor/ckeditor/plugins/wblink/lang/en.js
After

selectResponsiveFG: 'Please select a RFG category',

add

selectOneForAll: 'Please select an OneForAll-item',

Log out, clear the browser cache and log in again. You should see now when selecting an OfaPage as link target an additional select box with the corresponding OfA items.

So far so good, but there are several restrictions*!
1. this will NOT work if OfA is used under a different name (the module allows to be renamed and uses the new name for its database tables too)
2. the plugin does not recognize whether OfA is used in "build detail pages" mode or not
3. it writes the absolute URL into the page. If you move the OfA item or change its title, the link you've once set will not work any more, since it is not updated. (No, there's no way to achieve this or place a dynamical link to a certain OfA item this way - the only way I can imagine how this could be solved would be developing a droplet for this).

*which are also valid for the other deep links (to NWI or news items etc) too

Last edited by florian (20.09.2021 08:16:53)


Nicht ärgern. Nur wundern.

Offline

#3 20.09.2021 15:22:31

losttrip
Member

Re: CKEditor Dev Edition - WBCE Links - include OFA item pages

Thank you for your time and effort. 

The restrictions you have noted will cause me to avoid this solution.  The main reason is that all of my OFA modules have been renamed.  Additionally, I try to avoid introducing absolute URL's because they will no doubt lead to issues in the future.

This is not of any great importance for me, I was just curious if there was a setting (in a config or somewhere) that I might have been missing.

Offline

Board footer

up