-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Etabliere Category und Entry als Model Class
- Loading branch information
Showing
4 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Alexplusde\Blaupause; | ||
|
||
use rex_yform_manager_dataset; | ||
use rex_extension_point; | ||
use rex_csrf_token; | ||
use rex_url; | ||
|
||
class Entry extends rex_yform_manager_dataset | ||
{ | ||
// https://github.com/yakamara/redaxo_yform/blob/master/docs/04_yorm.md#yorm-mit-eigener-model-class-verwenden | ||
// Lasse dir die Klasse anhand deines Tablesets selbst bauen: https://github.com/alexplusde/ymca | ||
// Nachfolgend ein Beispiel, um eigene Methoden zu erstellen | ||
public function getName(): string | ||
{ | ||
return $this->getValue('name'); | ||
} | ||
|
||
public static function epYformDataList(rex_extension_point $ep) | ||
{ | ||
/** @var rex_yform_manager_table $table */ | ||
$table = $ep->getParam('table'); | ||
if ($table->getTableName() !== self::table()->getTableName()) { | ||
return; | ||
} | ||
|
||
/** @var rex_yform_list $list */ | ||
$list = $ep->getSubject(); | ||
|
||
$list->setColumnFormat( | ||
'name', | ||
'custom', | ||
static function ($a) { | ||
$_csrf_key = self::table()->getCSRFKey(); | ||
$token = rex_csrf_token::factory($_csrf_key)->getUrlParams(); | ||
|
||
$params = []; | ||
$params['table_name'] = self::table()->getTableName(); | ||
$params['rex_yform_manager_popup'] = '0'; | ||
$params['_csrf_token'] = $token['_csrf_token']; | ||
$params['data_id'] = $a['list']->getValue('id'); | ||
$params['func'] = 'edit'; | ||
|
||
return '<a href="' . rex_url::backendPage('neues/entry', $params) . '">' . $a['value'] . '</a>'; | ||
}, | ||
); | ||
$list->setColumnFormat( | ||
'id', | ||
'custom', | ||
static function ($a) { | ||
return $a['value']; | ||
}, | ||
); | ||
} | ||
} |