@@ -120,14 +120,13 @@ public function getForm($data = [], $loadData = true)
120120 return false ;
121121 }
122122
123- // Modify the form based on Edit State access controls.
124- if (empty ($ data ['context ' ])) {
125- $ data ['context ' ] = $ context ;
126- }
123+ $ record = new \stdClass ();
124+ $ record ->context = $ context ;
125+ $ record ->id = $ jinput ->get ('id ' );
127126
128127 $ user = $ this ->getCurrentUser ();
129128
130- if (!$ user -> authorise ( ' core.edit.state ' , $ context . ' .fieldgroup. ' . $ jinput -> get ( ' id ' ) )) {
129+ if (!$ this -> canEditState ( $ record )) {
131130 // Disable fields for display.
132131 $ form ->setFieldAttribute ('ordering ' , 'disabled ' , 'true ' );
133132 $ form ->setFieldAttribute ('state ' , 'disabled ' , 'true ' );
@@ -160,7 +159,9 @@ protected function canDelete($record)
160159 return false ;
161160 }
162161
163- return $ this ->getCurrentUser ()->authorise ('core.delete ' , $ record ->context . '.fieldgroup. ' . (int ) $ record ->id );
162+ $ component = explode ('. ' , $ record ->context )[0 ];
163+
164+ return $ this ->getCurrentUser ()->authorise ('core.delete ' , $ component . '.fieldgroup. ' . (int ) $ record ->id );
164165 }
165166
166167 /**
@@ -177,13 +178,15 @@ protected function canEditState($record)
177178 {
178179 $ user = $ this ->getCurrentUser ();
179180
181+ $ component = explode ('. ' , $ record ->context )[0 ];
182+
180183 // Check for existing fieldgroup.
181184 if (!empty ($ record ->id )) {
182- return $ user ->authorise ('core.edit.state ' , $ record -> context . '.fieldgroup. ' . (int ) $ record ->id );
185+ return $ user ->authorise ('core.edit.state ' , $ component . '.fieldgroup. ' . (int ) $ record ->id );
183186 }
184187
185188 // Default to component settings.
186- return $ user ->authorise ('core.edit.state ' , $ record -> context );
189+ return $ user ->authorise ('core.edit.state ' , $ component );
187190 }
188191
189192 /**
0 commit comments