Advertisement
Guest User

Untitled

a guest
Aug 21st, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php namespace Wetzel\Aktiviteiten\Controllers;
  2.  
  3. use BackendMenu;
  4. use Backend\Classes\Controller;
  5.  
  6. class Aktiviteiten extends Controller
  7. {
  8.     public $implement = [
  9.         'Backend.Behaviors.FormController',
  10.         'Backend.Behaviors.ListController'
  11.     ];
  12.  
  13.     public $formConfig = 'config_form.yaml';
  14.     public $listConfig = 'config_list.yaml';
  15.  
  16.     public function __construct()
  17.     {
  18.         parent::__construct();
  19.         BackendMenu::setContext('Wetzel.Aktiviteiten', 'aktiviteiten', 'aktiviteiten');
  20.     }
  21.  
  22.     public function formExtendFields($form)
  23.     {
  24.       // add registration Field when context is update
  25.       if($form->context == 'update'){
  26.         $recordId   = $form->model->attributes['id'];
  27.         //Get Labels
  28.         $data = json_decode($form->model->original['form_data']);
  29.         foreach($data as $column){
  30.           $labels[$column->label] = ['title' => $column->label];
  31.         }
  32.  
  33.         $form->addTabFields([
  34.         'registrations' => [
  35.             'label'=>'Unmeldungen',
  36.             'tab' => 'Unmeldungen',
  37.             'type'=>'datatable',
  38.                 'columns' => $labels
  39.           ]]
  40.         );
  41.        }
  42.       }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement