Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php namespace Wetzel\Aktiviteiten\Controllers;
- use BackendMenu;
- use Backend\Classes\Controller;
- class Aktiviteiten extends Controller
- {
- public $implement = [
- 'Backend.Behaviors.FormController',
- 'Backend.Behaviors.ListController'
- ];
- public $formConfig = 'config_form.yaml';
- public $listConfig = 'config_list.yaml';
- public function __construct()
- {
- parent::__construct();
- BackendMenu::setContext('Wetzel.Aktiviteiten', 'aktiviteiten', 'aktiviteiten');
- }
- public function formExtendFields($form)
- {
- // add registration Field when context is update
- if($form->context == 'update'){
- $recordId = $form->model->attributes['id'];
- //Get Labels
- $data = json_decode($form->model->original['form_data']);
- foreach($data as $column){
- $labels[$column->label] = ['title' => $column->label];
- }
- $form->addTabFields([
- 'registrations' => [
- 'label'=>'Unmeldungen',
- 'tab' => 'Unmeldungen',
- 'type'=>'datatable',
- 'columns' => $labels
- ]]
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement