@@ -86,6 +86,7 @@ public static function extract($contextString, $item = null)
86
86
return $ parts ;
87
87
}
88
88
89
+
89
90
/**
90
91
* Returns the fields for the given context.
91
92
* If the item is an object the returned fields do have an additional field
@@ -214,14 +215,14 @@ function ($f) {
214
215
*/
215
216
$ dispatcher ->dispatch ('onCustomFieldsBeforePrepareField ' , new BeforePrepareFieldEvent ('onCustomFieldsBeforePrepareField ' , [
216
217
'context ' => $ context ,
217
- 'item ' => $ item ,
218
+ 'item ' => $ item ,
218
219
'subject ' => $ field ,
219
220
]));
220
221
221
222
// Gathering the value for the field
222
223
$ value = $ dispatcher ->dispatch ('onCustomFieldsPrepareField ' , new PrepareFieldEvent ('onCustomFieldsPrepareField ' , [
223
224
'context ' => $ context ,
224
- 'item ' => $ item ,
225
+ 'item ' => $ item ,
225
226
'subject ' => $ field ,
226
227
]))->getArgument ('result ' , []);
227
228
@@ -238,9 +239,9 @@ function ($f) {
238
239
*/
239
240
$ eventAfter = new AfterPrepareFieldEvent ('onCustomFieldsAfterPrepareField ' , [
240
241
'context ' => $ context ,
241
- 'item ' => $ item ,
242
+ 'item ' => $ item ,
242
243
'subject ' => $ field ,
243
- 'value ' => &$ value , // @todo: Remove reference in Joomla 6, see AfterPrepareFieldEvent::__constructor()
244
+ 'value ' => &$ value , // @todo: Remove reference in Joomla 6, see AfterPrepareFieldEvent::__constructor()
244
245
]);
245
246
$ dispatcher ->dispatch ('onCustomFieldsAfterPrepareField ' , $ eventAfter );
246
247
$ value = $ eventAfter ->getValue ();
@@ -309,7 +310,7 @@ public static function getField(
309
310
}
310
311
311
312
if (Multilanguage::isEnabled () && isset ($ item ->language ) && $ item ->language != '* ' ) {
312
- self ::$ fieldCache ->setState ('filter.language ' , ['* ' , $ item ->language ]);
313
+ self ::$ fieldsCache ->setState ('filter.language ' , ['* ' , $ item ->language ]);
313
314
}
314
315
315
316
self ::$ fieldCache ->setState ('filter.context ' , $ context );
@@ -368,14 +369,14 @@ public static function getField(
368
369
*/
369
370
$ dispatcher ->dispatch ('onCustomFieldsBeforePrepareField ' , new BeforePrepareFieldEvent ('onCustomFieldsBeforePrepareField ' , [
370
371
'context ' => $ context ,
371
- 'item ' => $ item ,
372
+ 'item ' => $ item ,
372
373
'subject ' => $ field ,
373
374
]));
374
375
375
376
// Gathering the value for the field
376
377
$ value = $ dispatcher ->dispatch ('onCustomFieldsPrepareField ' , new PrepareFieldEvent ('onCustomFieldsPrepareField ' , [
377
378
'context ' => $ context ,
378
- 'item ' => $ item ,
379
+ 'item ' => $ item ,
379
380
'subject ' => $ field ,
380
381
]))->getArgument ('result ' , []);
381
382
@@ -392,9 +393,9 @@ public static function getField(
392
393
*/
393
394
$ eventAfter = new AfterPrepareFieldEvent ('onCustomFieldsAfterPrepareField ' , [
394
395
'context ' => $ context ,
395
- 'item ' => $ item ,
396
+ 'item ' => $ item ,
396
397
'subject ' => $ field ,
397
- 'value ' => &$ value , // @todo: Remove reference in Joomla 6, see AfterPrepareFieldEvent::__constructor()
398
+ 'value ' => &$ value , // @todo: Remove reference in Joomla 6, see AfterPrepareFieldEvent::__constructor()
398
399
]);
399
400
$ dispatcher ->dispatch ('onCustomFieldsAfterPrepareField ' , $ eventAfter );
400
401
$ value = $ eventAfter ->getValue ();
@@ -437,7 +438,7 @@ public static function render($context, $layoutFile, $displayData)
437
438
438
439
if ($ value == '' ) {
439
440
// Trying to render the layout on Fields itself
440
- $ value = LayoutHelper::render ($ layoutFile , $ displayData , null , ['component ' => 'com_fields ' , 'client ' => 0 ]);
441
+ $ value = LayoutHelper::render ($ layoutFile , $ displayData , null , ['component ' => 'com_fields ' ,'client ' => 0 ]);
441
442
}
442
443
443
444
return $ value ;
@@ -459,7 +460,7 @@ public static function prepareForm($context, Form $form, $data)
459
460
// Extracting the component and section
460
461
$ parts = self ::extract ($ context );
461
462
462
- if (!$ parts ) {
463
+ if (! $ parts ) {
463
464
return true ;
464
465
}
465
466
@@ -468,12 +469,12 @@ public static function prepareForm($context, Form $form, $data)
468
469
// When no fields available return here
469
470
$ fields = self ::getFields ($ parts [0 ] . '. ' . $ parts [1 ]);
470
471
471
- if (!$ fields ) {
472
+ if (! $ fields ) {
472
473
return true ;
473
474
}
474
475
475
476
$ component = $ parts [0 ];
476
- $ section = $ parts [1 ];
477
+ $ section = $ parts [1 ];
477
478
478
479
$ assignedCatids = $ data ->catid ?? $ data ->fieldscatid ?? $ form ->getValue ('catid ' );
479
480
@@ -520,7 +521,7 @@ public static function prepareForm($context, Form $form, $data)
520
521
$ fieldTypes = self ::getFieldTypes ();
521
522
522
523
// Creating the dom
523
- $ xml = new \DOMDocument ('1.0 ' , 'UTF-8 ' );
524
+ $ xml = new \DOMDocument ('1.0 ' , 'UTF-8 ' );
524
525
$ fieldsNode = $ xml ->appendChild (new \DOMElement ('form ' ))->appendChild (new \DOMElement ('fields ' ));
525
526
$ fieldsNode ->setAttribute ('name ' , 'com_fields ' );
526
527
@@ -561,11 +562,11 @@ public static function prepareForm($context, Form $form, $data)
561
562
* have the 'default' group with id 0 which is not in the database,
562
563
* so we create it virtually here.
563
564
*/
564
- $ defaultGroup = new \stdClass ();
565
- $ defaultGroup ->id = 0 ;
566
- $ defaultGroup ->title = '' ;
565
+ $ defaultGroup = new \stdClass ();
566
+ $ defaultGroup ->id = 0 ;
567
+ $ defaultGroup ->title = '' ;
567
568
$ defaultGroup ->description = '' ;
568
- $ iterateGroups = array_merge ([$ defaultGroup ], $ model ->getItems ());
569
+ $ iterateGroups = array_merge ([$ defaultGroup ], $ model ->getItems ());
569
570
570
571
// Looping through the groups
571
572
foreach ($ iterateGroups as $ group ) {
@@ -580,7 +581,7 @@ public static function prepareForm($context, Form $form, $data)
580
581
$ fieldset ->setAttribute ('addfieldpath ' , '/administrator/components/ ' . $ component . '/models/fields ' );
581
582
$ fieldset ->setAttribute ('addrulepath ' , '/administrator/components/ ' . $ component . '/models/rules ' );
582
583
583
- $ label = $ group ->title ;
584
+ $ label = $ group ->title ;
584
585
$ description = $ group ->description ;
585
586
586
587
if (!$ label ) {
@@ -608,9 +609,9 @@ public static function prepareForm($context, Form $form, $data)
608
609
foreach ($ fieldsPerGroup [$ group ->id ] as $ field ) {
609
610
try {
610
611
$ dispatcher ->dispatch ('onCustomFieldsPrepareDom ' , new PrepareDomEvent ('onCustomFieldsPrepareDom ' , [
611
- 'subject ' => $ field ,
612
+ 'subject ' => $ field ,
612
613
'fieldset ' => $ fieldset ,
613
- 'form ' => $ form ,
614
+ 'form ' => $ form ,
614
615
]));
615
616
616
617
/*
@@ -739,7 +740,7 @@ public static function getAssignedCategoriesIds($fieldId)
739
740
return [];
740
741
}
741
742
742
- $ db = Factory::getDbo ();
743
+ $ db = Factory::getDbo ();
743
744
$ query = $ db ->getQuery (true );
744
745
745
746
$ query ->select ($ db ->quoteName ('a.category_id ' ))
@@ -768,7 +769,7 @@ public static function getAssignedCategoriesTitles($fieldId)
768
769
return [];
769
770
}
770
771
771
- $ db = Factory::getDbo ();
772
+ $ db = Factory::getDbo ();
772
773
$ query = $ db ->getQuery (true );
773
774
774
775
$ query ->select ($ db ->quoteName ('c.title ' ))
@@ -791,7 +792,7 @@ public static function getAssignedCategoriesTitles($fieldId)
791
792
*/
792
793
public static function getFieldsPluginId ()
793
794
{
794
- $ db = Factory::getDbo ();
795
+ $ db = Factory::getDbo ();
795
796
$ query = $ db ->getQuery (true )
796
797
->select ($ db ->quoteName ('extension_id ' ))
797
798
->from ($ db ->quoteName ('#__extensions ' ))
@@ -856,7 +857,7 @@ public static function getFieldTypes()
856
857
*/
857
858
public static function clearFieldsCache ()
858
859
{
859
- self ::$ fieldCache = null ;
860
- self ::$ fieldCache = null ;
860
+ self ::$ fieldCache = null ;
861
+ self ::$ fieldsCache = null ;
861
862
}
862
- }
863
+ }
0 commit comments