Skip to content

Commit

Permalink
Merge pull request #33 from alexplusde/main-menu-add
Browse files Browse the repository at this point in the history
`+`-Schaltfläche im Hauptmenü zum Hinzufügen neuer Einträge
  • Loading branch information
alxndr-w committed Jul 27, 2024
2 parents 1e7f6ee + f3ee337 commit d001c17
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,25 @@ static function ($a) {
);
}
});

if (rex::isBackend() && rex_addon::get('qanda') && rex_addon::get('qanda')->isAvailable() && !rex::isSafeMode()) {
$addon = rex_addon::get('qanda');
$pages = $addon->getProperty('pages');

if (!rex::getConsole()) {
$_csrf_key = rex_yform_manager_table::get('rex_qanda')->getCSRFKey();

$token = rex_csrf_token::factory($_csrf_key)->getUrlParams();

$params = [];
$params['table_name'] = 'rex_qanda'; // Tabellenname anpassen
$params['rex_yform_manager_popup'] = '0';
$params['_csrf_token'] = $token['_csrf_token'];
$params['func'] = 'add';

$href = rex_url::backendPage('qanda/entry', $params);

$pages['qanda']['title'] .= ' <a class="label label-primary tex-primary" style="position: absolute; right: 18px; top: 10px; padding: 0.2em 0.6em 0.3em; border-radius: 3px; color: white; display: inline; width: auto;" href="' . $href . '">+</a>';
$addon->setProperty('pages', $pages);
}
}

0 comments on commit d001c17

Please sign in to comment.