| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Backpack\PageManager\app\Http\Controllers\Admin; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use App\PageTemplates; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | // VALIDATION: change the requests to match your own file names if you need form validation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Backpack\CRUD\app\Http\Controllers\CrudController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Backpack\PageManager\app\Http\Requests\PageRequest as StoreRequest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Backpack\PageManager\app\Http\Requests\PageRequest as UpdateRequest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | class PageCrudController extends CrudController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     use PageTemplates; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     public function setup($template_name = false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |         parent::__construct(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |         $modelClass = config('backpack.pagemanager.page_model_class', 'Backpack\PageManager\app\Models\Page'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |         /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         | BASIC CRUD INFORMATION | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $this->crud->setModel($modelClass); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $this->crud->setRoute(config('backpack.base.route_prefix').'/page'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $this->crud->setEntityNameStrings(trans('backpack::pagemanager.page'), trans('backpack::pagemanager.pages')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         | COLUMNS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $this->crud->addColumn([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |                                 'name' => 'name', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |                                 'label' => trans('backpack::pagemanager.name'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                                 ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $this->crud->addColumn([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |                                 'name' => 'template', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |                                 'label' => trans('backpack::pagemanager.template'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |                                 'type' => 'model_function', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |                                 'function_name' => 'getTemplateName', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |                                 ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $this->crud->addColumn([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |                                 'name' => 'slug', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                                 'label' => trans('backpack::pagemanager.slug'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |                                 ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         | FIELDS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         // In PageManager, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         // - default fields, that all templates are using, are set using $this->addDefaultPageFields(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         // - template-specific fields are set per-template, in the PageTemplates trait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         | BUTTONS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         |-------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $this->crud->addButtonFromModelFunction('line', 'open', 'getOpenButton', 'beginning'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     // ----------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     // Overwrites of CrudController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     // ----------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     // Overwrites the CrudController create() method to add template usage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     public function create($template = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $this->addDefaultPageFields($template); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $this->useTemplate($template); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         return parent::create(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     // Overwrites the CrudController store() method to add template usage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     public function store(StoreRequest $request) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         $this->addDefaultPageFields(\Request::input('template')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $this->useTemplate(\Request::input('template')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         return parent::storeCrud(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     // Overwrites the CrudController edit() method to add template usage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     public function edit($id, $template = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         // if the template in the GET parameter is missing, figure it out from the db | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         if ($template == false) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             $model = $this->crud->model; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             $this->data['entry'] = $model::findOrFail($id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             $template = $this->data['entry']->template; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         $this->addDefaultPageFields($template); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         $this->useTemplate($template); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         return parent::edit($id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 107 |  |  |     // Overwrites the CrudController update() method to add template usage. | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |     public function update(UpdateRequest $request) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |         $this->addDefaultPageFields(\Request::input('template')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |         $this->useTemplate(\Request::input('template')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |         return parent::updateCrud(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     // ----------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     // Methods that are particular to the PageManager. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     // ----------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * Populate the create/update forms with basic fields, that all pages need. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      * @param string $template The name of the template that should be used in the current form. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     public function addDefaultPageFields($template = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         $this->crud->addField([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |                                 'name' => 'template', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |                                 'label' => trans('backpack::pagemanager.template'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |                                 'type' => 'select_page_template', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |                                 'options' => $this->getTemplatesArray(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |                                 'value' => $template, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |                                 'allows_null' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |                                 'wrapperAttributes' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |                                     'class' => 'form-group col-md-6', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |                                 ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |                             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         $this->crud->addField([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |                                 'name' => 'name', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |                                 'label' => trans('backpack::pagemanager.page_name'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |                                 'type' => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |                                 'wrapperAttributes' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |                                     'class' => 'form-group col-md-6', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |                                 ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |                                 // 'disabled' => 'disabled' | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |                             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         $this->crud->addField([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |                                 'name' => 'title', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |                                 'label' => trans('backpack::pagemanager.page_title'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |                                 'type' => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |                                 // 'disabled' => 'disabled' | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |                             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |         $this->crud->addField([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |                                 'name' => 'slug', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |                                 'label' => trans('backpack::pagemanager.page_slug'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |                                 'type' => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |                                 'hint' => trans('backpack::pagemanager.page_slug_hint'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |                                 // 'disabled' => 'disabled' | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |                             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |      * Add the fields defined for a specific template. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |      * @param  string $template_name The name of the template that should be used in the current form. | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |     public function useTemplate($template_name = false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         $templates = $this->getTemplates(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         // set the default template | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |         if ($template_name == false) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             $template_name = $templates[0]->name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         // actually use the template | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         if ($template_name) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |             $this->{$template_name}(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * Get all defined templates. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     public function getTemplates($template_name = false) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         $templates_array = []; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         $templates_trait = new \ReflectionClass('App\PageTemplates'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         $templates = $templates_trait->getMethods(\ReflectionMethod::IS_PRIVATE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |         if (! count($templates)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |             abort(503, trans('backpack::pagemanager.template_not_found')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |         return $templates; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      * Get all defined template as an array. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      * Used to populate the template dropdown in the create/update forms. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     public function getTemplatesArray() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         $templates = $this->getTemplates(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |         foreach ($templates as $template) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |             $templates_array[$template->name] = $this->crud->makeLabel($template->name); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |         return $templates_array; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 214 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 215 |  |  |  | 
            
                        
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.