Skip to content

Commit

Permalink
Merge pull request #89 from FriendsOfREDAXO/cb-1
Browse files Browse the repository at this point in the history
boot.php gestrafft
  • Loading branch information
alxndr-w authored Aug 19, 2024
2 parents 053f9ec + aa2cf0a commit 9fb1e43
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
78 changes: 48 additions & 30 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,69 @@
use rex_url;
use rex_yform_manager_dataset;

if (rex_addon::get('cronjob')->isAvailable() && !rex::isSafeMode()) {
rex_cronjob_manager::registerType(Cronjob\Publish::class);
rex_cronjob_manager::registerType(Cronjob\Sync::class);
}
use function count;

if (rex_addon::get('yform')->isAvailable() && !rex::isSafeMode()) {
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_entry'),
Entry::class,
);
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_category'),
Category::class,
);
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_author'),
Author::class,
);
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_entry_lang'),
EntryLang::class,
);
}
/**
* Tabellen in YForm mit eigener Model-Class.
*/
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_entry'),
Entry::class,
);
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_category'),
Category::class,
);
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_author'),
Author::class,
);
rex_yform_manager_dataset::setModelClass(
rex::getTable('neues_entry_lang'),
EntryLang::class,
);

/**
* RSS-Fead via rex-api anbieten.
*/
rex_api_function::register('neues_rss', Api\Rss::class);

if (rex_plugin::get('yform', 'rest')->isAvailable() && !rex::isSafeMode()) {
/**
* Optionale Dienste:
* - Cronjobs nur bereitstellen, wenn das Addon verfügbar ist
* - REST-API nur aktivieren wenn das YForm-REST-Plugin aktiviert ist
*/
if (rex_addon::get('cronjob')->isAvailable()) {
rex_cronjob_manager::registerType(Cronjob\Publish::class);
rex_cronjob_manager::registerType(Cronjob\Sync::class);
}
if (rex_plugin::get('yform', 'rest')->isAvailable()) {
Api\Restful::init();
}

rex_extension::register('YFORM_DATA_LIST', Entry::epYformDataList(...));

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

if ($_REQUEST) {
/**
* Individualiserte Liste für Enries.
*/
rex_extension::register('YFORM_DATA_LIST', Entry::epYformDataList(...));

/**
* Plus(Add)-Button im Hauptmenü-Punkt des Addon bereitstellen.
*
* RexStan: Using $_REQUEST is forbidden, use rex_request::request() or rex_request() instead.
* Kommentar: Für diese Nutzung ist keine rex-Alternative verfügbar
* @phpstan-ignore-next-line
*/
if (0 < count($_REQUEST)) {
$_csrf_key = Entry::table()->getCSRFKey();

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

$params = [];
$params['table_name'] = Entry::table()->getTableName(); // Tabellenname anpassen
$params['rex_yform_manager_popup'] = '0';
$params['_csrf_token'] = $token['_csrf_token'];
$params['func'] = 'add';

$href = rex_url::backendPage('neues/entry', $params);
Expand Down
4 changes: 1 addition & 3 deletions package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ load: late

requires:
php:

version: '>7.3,<9'
redaxo: ^5.17


packages:
yform: '^4'
yform/manager: '^4'
yform_field: '^2.3.0'

page:
Expand Down

0 comments on commit 9fb1e43

Please sign in to comment.