Make your plugin compatible to Admidio 4

In Admidio 4 we have changed the way the menu is structured. For this you have to change your plugin if you have worked with $page→getMenu(); before.

Now you don't have to create an instance of the menu to add the single entries there. Also there is now a simple function to add a back button to the page.

So far you had to do the following steps for the back button:

$page = new HtmlPage('My Headline');
$myMenu = $page->getMenu();
$myMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'fa-arrow-circle-left');

Now it's only necessary to call the following function:

$page = new HtmlPage('My Headline');
$page->setUrlPreviousPage($gNavigation->getPreviousUrl());

If you want to add a menu entry to the page than just add this code:

$page->addPageFunctionsMenuItem('menu_item_new', 'Name of Menuentry', ADMIDIO_URL.FOLDER_MODULES.'/groups-roles/groups_roles_new.php', 'fa-plus-circle');

$page→hideThemeHtml(); is replaced by $page→setInlineMode();

$page→hideMenu(); is replaced by $page→setInlineMode();

safeurl('your-url') is replaced by SecurityUtils::encodeUrl('your-url')

The HtmlPage constructor has become a new necessary parameter:

$page = new HtmlPage('My Headline');
// must now be
$page = new HtmlPage('admidio-page-id', 'My Headline');

New method to open the modal window. Just add a class and a data-href:

<a class="openPopup" href="javascript:void(0);" data-href="http://www.example.com">My Link to a modal window</a>

FIELD_DEFAULT is replaced by HtmlForm::FIELD_DEFAULT

FIELD_REQUIRED is replaced by HtmlForm::FIELD_REQUIRED

FIELD_DISABLED is replaced by HtmlForm::FIELD_DISABLED

FIELD_READONLY is replaced by HtmlForm::FIELD_READONLY

FIELD_HIDDEN is replaced by HtmlForm::FIELD_HIDDEN

  • en/entwickler/make_your_plugin_compatible_to_admidio_4.txt
  • Last modified: 2021/01/05 14:15
  • by fasse