-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclass.tx_templavoila_api.php
1783 lines (1540 loc) · 78.6 KB
/
class.tx_templavoila_api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/***************************************************************
* Copyright notice
*
* (c) 2005-2006 Robert Lemke ([email protected])
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Public API for TemplaVoila
*
* $Id$
*
* @author Robert Lemke <[email protected]>
*/
/**
* Public API class for proper handling of content elements and other useful TemplaVoila related functions
*
* @author Robert Lemke <[email protected]>
* @package TYPO3
* @subpackage tx_templavoila
*/
class tx_templavoila_api {
var $rootTable;
var $debug = false;
var $allSystemWebsiteLanguages = array(); // ->loadWebsiteLanguages() will set this to content of sys_language
var $modifyReferencesInLiveWS = false;
protected $cachedModWebTSconfig = array();
/**
* The constructor.
*
* @param string $rootTable: Usually the root table is "pages" but another table can be specified (eg. "tt_content")
* @return void
* @access public
*/
function __construct ($rootTable = 'pages') {
$this->rootTable = $rootTable;
}
/**
* PHP4 compatible constructor
*
* @param string $alternativeRootTable: Usually the root table is "pages" but another table can be specified (eg. "tt_content")
* @return void
*/
function tx_templavoila_api ($alternativeRootTable = 'pages') {
return $this->__construct ($alternativeRootTable);
}
/******************************************************
*
* Element manipulation functions (public)
*
******************************************************/
/**
* Creates a new content element record and sets the neccessary references to connect
* it to the parent element.
*
* @param array $destinationPointer: Flexform pointer defining the parent location of the new element. Position refers to the element _after_ which the new element should be inserted. Position == 0 means before the first element.
* @param array $elementRow: Array of field keys and values for the new content element record
* @return mixed The UID of the newly created record or FALSE if operation was not successful
* @access public
*/
function insertElement ($destinationPointer, $elementRow) {
if ($this->debug) t3lib_div::devLog ('API: insertElement()', 'templavoila', 0, array ('destinationPointer' => $destinationPointer, 'elementRow' => $elementRow));
if (!$destinationPointer = $this->flexform_getValidPointer($destinationPointer)) {
if ($this->debug) t3lib_div::devLog ('API#insertElement: flexform_getValidPointer() failed', 'templavoila', 0);
return FALSE;
}
$newRecordUid = $this->insertElement_createRecord($destinationPointer, $elementRow);
if ($newRecordUid === FALSE) {
if ($this->debug) t3lib_div::devLog ('API#insertElement: insertElement_createRecord() failed', 'templavoila', 0);
return FALSE;
}
$result = $this->insertElement_setElementReferences($destinationPointer, $newRecordUid);
if ($result === FALSE) {
if ($this->debug) t3lib_div::devLog ('API#insertElement: insertElement_setElementReferences() failed', 'templavoila', 0);
return FALSE;
}
return $newRecordUid;
}
/**
* Sub function of insertElement: creates a new tt_content record in the database.
*
* @param array $destinationPointer: flexform pointer to the parent element of the new record
* @param array $row: The record data to insert into the database
* @return mixed The UID of the newly created record or FALSE if operation was not successful
* @access public
*/
function insertElement_createRecord ($destinationPointer, $row) {
if ($this->debug) t3lib_div::devLog ('API: insertElement_createRecord()', 'templavoila', 0, array ('destinationPointer' => $destinationPointer, 'row' => $row));
$parentRecord = t3lib_BEfunc::getRecordWSOL($destinationPointer['table'], $destinationPointer['uid'],'uid,pid,t3ver_oid,tx_templavoila_flex');
if ($destinationPointer['position'] > 0) {
$currentReferencesArr = $this->flexform_getElementReferencesFromXML ($parentRecord['tx_templavoila_flex'], $destinationPointer);
}
$newRecordPid = ($destinationPointer['table'] == 'pages' ? ($parentRecord['pid'] == -1 ? $parentRecord['t3ver_oid'] : $parentRecord['uid']) : $parentRecord['pid']);
$dataArr = array();
$dataArr['tt_content']['NEW'] = $row;
$dataArr['tt_content']['NEW']['pid'] = $newRecordPid;
unset($dataArr['tt_content']['NEW']['uid']);
// If the destination is not the default language, try to set the old-style sys_language_uid field accordingly
if ($destinationPointer['sLang'] != 'lDEF' || $destinationPointer['vLang'] != 'vDEF') {
$languageKey = $destinationPointer['vLang'] != 'vDEF' ? $destinationPointer['vLang'] : $destinationPointer['sLang'];
$staticLanguageRows = t3lib_BEfunc::getRecordsByField('static_languages', 'lg_iso_2', substr($languageKey, 1));
if (isset($staticLanguageRows[0]['uid'])) {
$languageRecord = t3lib_BEfunc::getRecordRaw('sys_language', 'static_lang_isocode='.intval($staticLanguageRows[0]['uid']));
if (isset($languageRecord['uid'])) {
$dataArr['tt_content']['NEW']['sys_language_uid'] = $languageRecord['uid'];
}
}
}
// Instantiate TCEmain and create the record:
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
/* @var $tce t3lib_TCEmain */
// set default TCA values specific for the page and user
$TCAdefaultOverride = t3lib_BEfunc::getModTSconfig($newRecordPid , 'TCAdefaults');
if (is_array($TCAdefaultOverride['properties'])) {
$tce->setDefaultsFromUserTS($TCAdefaultOverride['properties']);
}
$tce->stripslashes_values = 0;
$flagWasSet = $this->getTCEmainRunningFlag();
$this->setTCEmainRunningFlag (TRUE);
if ($this->debug) t3lib_div::devLog ('API: insertElement_createRecord()', 'templavoila', 0, array('dataArr' => $dataArr));
$tce->start($dataArr,array());
$tce->process_datamap();
if ($this->debug && count($tce->errorLog)) {
t3lib_div::devLog ('API: insertElement_createRecord(): tcemain failed', 'templavoila', 0, array('errorLog' => $tce->errorLog));
}
$newUid = $tce->substNEWwithIDs['NEW'];
if (!$flagWasSet) $this->setTCEmainRunningFlag (FALSE);
return (intval($newUid) ? intval($newUid) : FALSE);
}
/**
* Sub function of insertElement: sets the references in the parent element for a newly created tt_content
* record.
*
* @param array $destinationPointer: Flexform pointer defining the parent element of the new element. Position refers to the element _after_ which the new element should be inserted. Position == 0 means before the first element.
* @param array $uid: UID of the tt_content record
* @return void
* @access public
*/
function insertElement_setElementReferences ($destinationPointer, $uid) {
if ($this->debug) t3lib_div::devLog ('API: insertElement_setElementReferences()', 'templavoila', 0, array ('destinationPointer' => $destinationPointer, 'uid' => $uid));
$parentRecord = t3lib_BEfunc::getRecordWSOL($destinationPointer['table'], $destinationPointer['uid'],'uid,pid,tx_templavoila_flex');
if (!is_array ($parentRecord)) return FALSE;
$currentReferencesArr = $this->flexform_getElementReferencesFromXML ($parentRecord['tx_templavoila_flex'], $destinationPointer);
$newReferencesArr = $this->flexform_insertElementReferenceIntoList ($currentReferencesArr, $destinationPointer['position'], $uid);
$this->flexform_storeElementReferencesListInRecord ($newReferencesArr, $destinationPointer);
return TRUE;
}
/**
* Moves an element specified by the source pointer to the location specified by
* destination pointer.
*
* @param array $sourcePointer: flexform pointer pointing to the element which shall be moved
* @param array $destinationPointer: flexform pointer to the new location
* @return boolean TRUE if operation was successfuly, otherwise false
* @access public
*/
function moveElement ($sourcePointer, $destinationPointer) {
if ($this->debug) t3lib_div::devLog ('API: moveElement()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer, 'destinationPointer' => $destinationPointer));
return $this->process ('move', $sourcePointer, $destinationPointer);
}
/**
* Sets all references for moving an element specified by the source pointer to the location specified by
* destination pointer. The record itself won't be modified and therefore setting the PID etc. must be
* handled elsewhere.
*
* @param array $sourcePointer: flexform pointer pointing to the element which shall be moved
* @param array $destinationPointer: flexform pointer to the new location
* @return boolean TRUE if operation was successfuly, otherwise false
* @access public
*/
function moveElement_setElementReferences ($sourcePointer, $destinationPointer) {
if ($this->debug) t3lib_div::devLog ('API: moveElement_setElementReferences()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer, 'destinationPointer' => $destinationPointer));
return $this->process ('move', $sourcePointer, $destinationPointer, TRUE);
}
/**
* Makes a true copy of an element specified by the source pointer to the location specified by
* destination pointer. By default also copies all sub elements but can be disabled so sub elements
* are not copied but referenced.
*
* @param array $sourcePointer: flexform pointer pointing to the element which shall be copied
* @param array $destinationPointer: flexform pointer to the location for the copy
* @param boolean $copySubElements: If set to TRUE, also all sub elements will be truly copied
* @return mixed UID of the created copy, otherwise FALSE
* @access public
*/
function copyElement ($sourcePointer, $destinationPointer, $copySubElements = TRUE) {
if ($this->debug) t3lib_div::devLog ('API: copyElement()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer, 'destinationPointer' => $destinationPointer, 'copySubElements' => $copySubElements));
return $this->process ($copySubElements ? 'copyrecursively' : 'copy', $sourcePointer, $destinationPointer);
}
/**
* Makes a true copy of a tt_content element specified by the source pointer to the same location but with
* the language specified by "languageKey". The new element will refer to the source element as the
* original version.
*
* Note: This function is only used with "translationParadigm = free" (see Page Module TSconfig). In the
* "bound" paradigm, TCEmain is called directly because localized elements won't be referenced
*
* @param array $sourcePointer: flexform pointer pointing to the element which shall be localized
* @param string $languageKey: A two letter ISO language key (eg. 'EN')
* @return mixed UID of the created copy, otherwise FALSE
* @access public
*/
function localizeElement ($sourcePointer, $languageKey) {
global $TCA;
if ($this->debug) t3lib_div::devLog ('API: localizeElement()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer, 'languageKey' => $languageKey));
$sourceElementRecord = $this->flexform_getRecordByPointer ($sourcePointer);
$parentPageRecord = t3lib_beFunc::getRecordWSOL('pages', $sourceElementRecord['pid']);
$rawPageDataStructureArr = t3lib_BEfunc::getFlexFormDS($TCA['pages']['columns']['tx_templavoila_flex']['config'], $parentPageRecord, 'pages');
if (!is_array($rawPageDataStructureArr)) return FALSE;
if ($rawPageDataStructureArr['meta']['langDisable'] == 1) {
if ($this->debug) t3lib_div::devLog ('API: localizeElement(): Cannot localize element because localization is disabled for the active page datastructure!', 'templavoila', 0);
return FALSE;
}
// Build destination pointer:
$destinationPointer = $sourcePointer;
$destinationPointer['sLang'] = $rawPageDataStructureArr['meta']['langChildren'] == 1 ? 'lDEF' : 'l'.$languageKey;
$destinationPointer['vLang'] = $rawPageDataStructureArr['meta']['langChildren'] == 1 ? 'v'.$languageKey : 'vDEF';
$destinationPointer['position'] = -1;
$destinationPointer['_languageKey'] = $languageKey;
$newElementUid = $this->process ('localize', $sourcePointer, $destinationPointer);
return $newElementUid;
}
/**
* Creates a reference to the element specified by the source pointer at the location specified by
* destination pointer.
*
* @param array $sourcePointer: flexform pointer pointing to the reference target
* @param array $destinationPointer: flexform pointer to the location where the reference should be stored
* @return boolean TRUE if operation was successfuly, otherwise false
* @access public
*/
function referenceElement ($sourcePointer, $destinationPointer) {
if ($this->debug) t3lib_div::devLog ('API: referenceElement()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer, 'destinationPointer' => $destinationPointer));
return $this->process ('reference', $sourcePointer, $destinationPointer);
}
/**
* Creates a reference to the tt_content record specified by $uid. Basically does the same
* like referenceElement() but doesn't use a sourcePointer to find the reference target.
*
* Use this function in those situations when no flexform pointer exists, for example if
* you want a reference an element which has not yet been referenced anywhere else.
*
* @param integer $uid: UID of the tt_content element which shall be referenced
* @param array $destinationPointer: flexform pointer to the location where the reference should be stored
* @return boolean TRUE if operation was successfuly, otherwise false
* @access public
*/
function referenceElementByUid ($uid, $destinationPointer) {
if ($this->debug) t3lib_div::devLog ('API: referenceElementByUid()', 'templavoila', 0, array ('uid' => $uid, 'destinationPointer' => $destinationPointer));
$sourcePointer = array (
'table' => 'tt_content',
'uid' => intval($uid)
);
return $this->process ('referencebyuid', $sourcePointer, $destinationPointer);
}
/**
* Removes a reference to the element (= unlinks) specified by the source pointer.
*
* @param array $sourcePointer: flexform pointer pointing to the reference which shall be removed
* @return boolean TRUE if operation was successfuly, otherwise false
* @access public
*/
function unlinkElement ($sourcePointer) {
if ($this->debug) t3lib_div::devLog ('API: unlinkElement()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer));
return $this->process ('unlink', $sourcePointer);
}
/**
* Removes a reference to the element (= unlinks) specified by the source pointer AND deletes the
* record.
*
* @param array $sourcePointer: flexform pointer pointing to the element which shall be deleted
* @return boolean TRUE if operation was successfuly, otherwise false
* @access public
*/
function deleteElement ($sourcePointer) {
if ($this->debug) t3lib_div::devLog ('API: deleteElement()', 'templavoila', 0, array ('sourcePointer' => $sourcePointer));
return $this->process ('delete', $sourcePointer);
}
/******************************************************
*
* Processing functions (protected)
*
******************************************************/
/**
* This method does the actually processing for the methods moveElement, copyElement etc.
*
* @param string $mode: Kind of processing
* @param array $sourcePointer: flexform pointer pointing to the element which will be processed. If "sheet", "sLang" etc. are set, it describes the position by specifying the (future) parent. If not, it describes the element directly with "table" and "uid".
* @param mixed $destinationPointer: flexform pointer to the destination location (if neccessary)
* @param boolean $onlyHandleReferences: If set, the record itself won't be moved, deleted etc. but only the references are set correctly. Use this feature if you are sure that the record has been handled before (eg. by TCEmain)
* @return mixed TRUE or something else (depends on operation) if operation was successful, otherwise FALSE
* @access protected
*/
function process ($mode, $sourcePointer, $destinationPointer = NULL, $onlyHandleReferences = FALSE) {
// Check and get all information about the source position:
if (!$sourcePointer = $this->flexform_getValidPointer ($sourcePointer)) return FALSE;
$sourceParentRecord = t3lib_BEfunc::getRecordWSOL($sourcePointer['table'], $sourcePointer['uid'],'uid,pid,tx_templavoila_flex');
if (!is_array ($sourceParentRecord)) {
if ($this->debug) t3lib_div::devLog ('process: Parent record of the element specified by source pointer does not exist!', 2, $sourcePointer);
return FALSE;
}
$sourceReferencesArr = $this->flexform_getElementReferencesFromXML ($sourceParentRecord['tx_templavoila_flex'], $sourcePointer);
// Check and get all information about the destination position:
if (is_array ($destinationPointer)) {
if (!$destinationPointer = $this->flexform_getValidPointer ($destinationPointer)) return FALSE;
$destinationParentRecord = t3lib_BEfunc::getRecordWSOL($destinationPointer['table'], $destinationPointer['uid'],'uid,pid,tx_templavoila_flex');
if (!is_array ($destinationParentRecord)) {
if ($this->debug) t3lib_div::devLog ('process: Parent record of the element specified by destination pointer does not exist!', 2, $destinationPointer);
return FALSE;
} elseif($destinationParentRecord['pid']<0 && $destinationPointer['table']!='pages') {
if ($this->debug) t3lib_div::devLog ('process: The destination pointer must always point to a live record, not an offline version!', 2, $destinationPointer);
return FALSE;
}
$destinationReferencesArr = $this->flexform_getElementReferencesFromXML ($destinationParentRecord['tx_templavoila_flex'], $destinationPointer);
}
// Get information about the element to be processed:
if (isset ($sourcePointer['sheet'])) {
$sourceElementRecord = t3lib_BEfunc::getRecordWSOL('tt_content', $sourceReferencesArr[$sourcePointer['position']],'*');
} else {
$sourceElementRecord = t3lib_BEfunc::getRecordWSOL('tt_content', $sourcePointer['uid'],'*');
}
switch ($mode) {
case 'move' : $result = $this->process_move ($sourcePointer, $destinationPointer, $sourceReferencesArr, $destinationReferencesArr, $sourceParentRecord, $destinationParentRecord, $sourceElementRecord, $onlyHandleReferences); break;
case 'copy': $result = $this->process_copy ($sourceElementRecord['uid'], $destinationPointer, $destinationReferencesArr, $destinationParentRecord); break;
case 'copyrecursively': $result = $this->process_copyRecursively ($sourceElementRecord['uid'], $destinationPointer, $destinationReferencesArr, $destinationParentRecord); break;
case 'localize': $result = $this->process_localize ($sourceElementRecord['uid'], $destinationPointer, $destinationReferencesArr); break;
case 'reference': $result = $this->process_reference ($destinationPointer, $destinationReferencesArr, $sourceElementRecord['uid']); break;
case 'referencebyuid': $result = $this->process_reference ($destinationPointer, $destinationReferencesArr, $sourcePointer['uid']); break;
case 'unlink': $result = $this->process_unlink ($sourcePointer, $sourceReferencesArr); break;
case 'delete': $result = $this->process_delete ($sourcePointer, $sourceReferencesArr, $sourceElementRecord['uid']); break;
}
return $result;
}
/**
* Actually moves the specified element and sets the element references of the parent element
* accordingly.
*
* @param array $sourcePointer: flexform pointer pointing to the element which will be moved
* @param array $destinationPointer: flexform pointer to the destination location
* @param array $sourceReferencesArr: Current list of the parent source's element references
* @param array $destinationReferencesArr: Current list of the parent destination's element references
* @param array $sourceParentRecord: Database record of the source location (either from table 'pages' or 'tt_content')
* @param array $destinationParentRecord: Database record of the destination location (either from table 'pages' or 'tt_content')
* @param array $elementRecord: The database record of the element to be moved
* @param boolean $onlyHandleReferences: If TRUE, only the references will be set, the record itself will not be moved (because that happens elsewhere)
* @return boolean TRUE if operation was successfuly, otherwise false
* @access protected
*/
function process_move ($sourcePointer, $destinationPointer, $sourceReferencesArr, $destinationReferencesArr, $sourceParentRecord, $destinationParentRecord, $elementRecord, $onlyHandleReferences) {
$elementUid = $elementRecord['uid'];
// Move the element within the same parent element:
$elementsAreWithinTheSameParentElement = (
$sourcePointer['table'] == $destinationPointer['table'] &&
$sourcePointer['uid'] == $destinationPointer['uid']
);
if ($elementsAreWithinTheSameParentElement) {
$elementsAreWithinTheSameParentField = (
$sourcePointer['sheet'] == $destinationPointer['sheet'] &&
$sourcePointer['sLang'] == $destinationPointer['sLang'] &&
$sourcePointer['field'] == $destinationPointer['field'] &&
$sourcePointer['vLang'] == $destinationPointer['vLang']
);
if ($elementsAreWithinTheSameParentField) {
$newPosition = ($sourcePointer['position'] < $destinationPointer['position']) ? $destinationPointer['position']-1 : $destinationPointer['position'];
$newReferencesArr = $this->flexform_removeElementReferenceFromList ($sourceReferencesArr, $sourcePointer['position']);
$newReferencesArr = $this->flexform_insertElementReferenceIntoList ($newReferencesArr, $newPosition, $elementUid);
$this->flexform_storeElementReferencesListInRecord ($newReferencesArr, $destinationPointer);
} else {
$sourceParentReferencesArr = $this->flexform_removeElementReferenceFromList ($sourceReferencesArr, $sourcePointer['position']);
$this->flexform_storeElementReferencesListInRecord ($sourceParentReferencesArr, $sourcePointer);
$destinationParentReferencesArr = $this->flexform_insertElementReferenceIntoList ($destinationReferencesArr, $destinationPointer['position'], $elementUid);
$this->flexform_storeElementReferencesListInRecord ($destinationParentReferencesArr, $destinationPointer);
}
} else {
// Move the element to a different parent element:
$newSourceReferencesArr = $this->flexform_removeElementReferenceFromList ($sourceReferencesArr, $sourcePointer['position']);
$newDestinationReferencesArr = $this->flexform_insertElementReferenceIntoList ($destinationReferencesArr, $destinationPointer['position'], $elementUid);
$this->flexform_storeElementReferencesListInRecord ($newSourceReferencesArr, $sourcePointer);
$this->flexform_storeElementReferencesListInRecord ($newDestinationReferencesArr, $destinationPointer);
// Move the records to the new page as well
if (!$onlyHandleReferences) {
$sourcePID = $sourcePointer['table'] == 'pages' ? $sourceParentRecord['uid'] : $sourceParentRecord['pid'];
$destinationPID = $destinationPointer['table'] == 'pages' ? $destinationParentRecord['uid'] : $destinationParentRecord['pid'];
// Determine uids of all sub elements of the element to be moved:
$dummyArr = array();
$elementUids = $this->flexform_getListOfSubElementUidsRecursively ('tt_content', $elementUid, $dummyArr);
$elementUids[] = $elementUid;
// Reduce the list to local elements to make sure that references are kept instead of moving the referenced record
$localRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid', 'tt_content', 'uid IN (' . implode(',', $elementUids) . ') AND pid=' . intval($sourcePID) . ' ' . t3lib_BEfunc::deleteClause('tt_content'));
if(!empty($localRecords) && is_array($localRecords)) {
foreach ($localRecords as $localRecord) {
$cmdArray['tt_content'][$localRecord['uid']]['move'] = $destinationPID;
}
$flagWasSet = $this->getTCEmainRunningFlag ();
$this->setTCEmainRunningFlag (TRUE);
$tce = t3lib_div::makeInstance ('t3lib_TCEmain');
$tce->stripslashes_values = 0;
$tce->start (array(), $cmdArray);
$tce->process_cmdmap ();
if (!$flagWasSet) {
$this->setTCEmainRunningFlag (FALSE);
}
}
}
}
return TRUE;
}
/**
* Makes a copy of the specified element and only points to the sub elements with references.
*
* @param integer $sourceElementUid: UID of the element to be copied
* @param array $destinationPointer: flexform pointer to the destination location
* @param array $destinationReferencesArr: Current list of the parent destination's element references
* @param array $destinationParentRecord: Database record of the destination location (either from table 'pages' or 'tt_content')
* @return mixed The UID of the newly created copy or FALSE if an error occurred.
* @access protected
*/
function process_copy ($sourceElementUid, $destinationPointer, $destinationReferencesArr, $destinationParentRecord) {
$destinationPID = $destinationPointer['table'] == 'pages' ? $destinationParentRecord['uid'] : $destinationParentRecord['pid'];
// Initialize TCEmain and create configuration for copying the specified record
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$cmdArray = array();
$cmdArray['tt_content'][$sourceElementUid]['copy'] = $destinationPID;
// Execute the copy process and finally insert the reference for the element to the destination:
$flagWasSet = $this->getTCEmainRunningFlag();
$this->setTCEmainRunningFlag (TRUE);
$tce->start(array(),$cmdArray);
$tce->process_cmdmap();
$newElementUid = $tce->copyMappingArray_merged['tt_content'][$sourceElementUid];
if (!$flagWasSet) $this->setTCEmainRunningFlag (FALSE);
$newDestinationReferencesArr = $this->flexform_insertElementReferenceIntoList ($destinationReferencesArr, $destinationPointer['position'], $newElementUid);
$this->flexform_storeElementReferencesListInRecord ($newDestinationReferencesArr, $destinationPointer);
return $newElementUid;
}
/**
* Makes a true copy of the specified element and all sub elements and sets the element references of the parent element
* accordingly.
*
* @param integer $sourceElementUid: UID of the element to be copied
* @param array $destinationPointer: flexform pointer to the destination location
* @param array $destinationReferencesArr: Current list of the parent destination's element references
* @param array $destinationParentRecord: Database record of the destination location (either from table 'pages' or 'tt_content')
* @return mixed The UID of the newly created copy or FALSE if an error occurred.
* @access protected
*/
function process_copyRecursively ($sourceElementUid, $destinationPointer, $destinationReferencesArr, $destinationParentRecord) {
// Determine the PID of the new location and get uids of all sub elements of the element to be copied:
$dummyArr = array();
$destinationPID = $destinationPointer['table'] == 'pages' ? $destinationParentRecord['uid'] : $destinationParentRecord['pid'];
$subElementUids = $this->flexform_getListOfSubElementUidsRecursively ('tt_content', $sourceElementUid, $dummyArr);
// Initialize TCEmain and create configuration for copying the specified record (the parent element) and all sub elements:
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$cmdArray = array();
$cmdArray['tt_content'][$sourceElementUid]['copy'] = $destinationPID;
foreach ($subElementUids as $subElementUid) {
$cmdArray['tt_content'][$subElementUid]['copy'] = $destinationPID;
}
// Execute the copy process and finally insert the reference for the parent element to the paste destination:
$flagWasSet = $this->getTCEmainRunningFlag();
$this->setTCEmainRunningFlag (TRUE);
$tce->start(array(),$cmdArray);
$tce->process_cmdmap();
if (!$flagWasSet) $this->setTCEmainRunningFlag (FALSE);
$newElementUid = $tce->copyMappingArray_merged['tt_content'][$sourceElementUid];
$newDestinationReferencesArr = $this->flexform_insertElementReferenceIntoList ($destinationReferencesArr, $destinationPointer['position'], $newElementUid);
$this->flexform_storeElementReferencesListInRecord ($newDestinationReferencesArr, $destinationPointer);
return $newElementUid;
}
/**
* Localizes the specified element and only points to the sub elements with references.
*
* @param integer $sourceElementUid: UID of the element to be copied
* @param array $destinationPointer: flexform pointer to the destination location
* @param array $destinationParentRecord: Database record of the destination location (either from table 'pages' or 'tt_content')
* @return mixed The UID of the newly created copy or FALSE if an error occurred.
* @access protected
*/
function process_localize ($sourceElementUid, $destinationPointer, $destinationReferencesArr) {
// Determine language record UID of the language we localize to:
$staticLanguageRows = t3lib_BEfunc::getRecordsByField('static_languages', 'lg_iso_2', $destinationPointer['_languageKey']);
if (is_array($staticLanguageRows) && isset($staticLanguageRows[0]['uid'])) {
$languageRecords = t3lib_BEfunc::getRecordsByField('sys_language', 'static_lang_isocode', $staticLanguageRows[0]['uid']);
}
if (is_array($languageRecords) && isset($languageRecords[0]['uid'])) {
$destinationLanguageUid = $languageRecords[0]['uid'];
} else {
if ($this->debug) t3lib_div::devLog ('API: process_localize(): Cannot localize element because sys_language record can not be found !', 'templavoila', 2);
return FALSE;
}
// Initialize TCEmain and create configuration for localizing the specified record
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$cmdArray = array();
$cmdArray['tt_content'][$sourceElementUid]['localize'] = $destinationLanguageUid;
// Execute the copy process and finally insert the reference for the element to the destination:
$flagWasSet = $this->getTCEmainRunningFlag();
$this->setTCEmainRunningFlag (TRUE);
$tce->start(array(),$cmdArray);
$tce->process_cmdmap();
$newElementUid = $tce->copyMappingArray_merged['tt_content'][$sourceElementUid];
if (!$flagWasSet) $this->setTCEmainRunningFlag (FALSE);
$newDestinationReferencesArr = $this->flexform_insertElementReferenceIntoList ($destinationReferencesArr, $destinationPointer['position'], $newElementUid);
$this->flexform_storeElementReferencesListInRecord ($newDestinationReferencesArr, $destinationPointer);
return $newElementUid;
}
/**
* Creates a reference which points to the specified element.
*
* @param array $destinationPointer: flexform pointer to the location where the reference should be stored
* @param array $destinationReferencesArr: Current list of the parent destination's element references
* @param integer $elementUid: UID of the tt_content element to be referenced
* @return boolean TRUE if the operation was successful or FALSE if an error occurred.
* @access protected
*/
function process_reference ($destinationPointer, $destinationReferencesArr, $elementUid) {
$newDestinationReferencesArr = $this->flexform_insertElementReferenceIntoList ($destinationReferencesArr, $destinationPointer['position'], $elementUid);
$this->flexform_storeElementReferencesListInRecord ($newDestinationReferencesArr, $destinationPointer);
return TRUE;
}
/**
* Removes the specified reference
*
* @param array $sourcePointer: flexform pointer pointing to the reference which shall be removed
* @param array $sourceReferencesArr: Current list of the parent source's element references
* @return boolean TRUE if the operation was successful, otherwise FALSE
* @access protected
*/
function process_unlink ($sourcePointer, $sourceReferencesArr) {
$newSourceReferencesArr = $this->flexform_removeElementReferenceFromList ($sourceReferencesArr, $sourcePointer['position']);
$this->flexform_storeElementReferencesListInRecord ($newSourceReferencesArr, $sourcePointer);
return TRUE;
}
/**
* Removes the specified reference and truly deletes the record
*
* @param array $sourcePointer: flexform pointer pointing to the element which will be the target of the reference
* @param array $sourceReferencesArr: Current list of the parent source's element references
* @param integer $elementUid: UID of the tt_content element to be deleted
* @return boolean TRUE if the operation was successful, otherwise FALSE
* @access protected
*/
function process_delete ($sourcePointer, $sourceReferencesArr, $elementUid) {
if (!$this->process_unlink ($sourcePointer, $sourceReferencesArr)) return FALSE;
$cmdArray = array();
$cmdArray['tt_content'][$elementUid]['delete'] = 1; // Element UID should always be that of the online version here...
// Store:
$flagWasSet = $this->getTCEmainRunningFlag();
$this->setTCEmainRunningFlag (TRUE);
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = 0;
$tce->start(array(),$cmdArray);
$tce->process_cmdmap();
if (!$flagWasSet) $this->setTCEmainRunningFlag (FALSE);
return TRUE;
}
/******************************************************
*
* Flexform helper functions (public)
*
******************************************************/
/**
* Checks if a flexform pointer points to a valid location, ie. the sheets,
* fields etc. exist in the target data structure. If it is valid, the pointer
* array will be returned.
*
* If 'targetCheckUid' is set, the uid of the record which is referenced by
* the pointer will be checked against it.
*
* This method take workspaces into account (by using workspace flexform data if available) but it does NOT (and should not!) remap UIDs!
*
* @param mixed $flexformPointer: A flexform pointer referring to the content element. Although an array is preferred, you may also pass a string which will be converted automatically by flexform_getPointerFromString()
* @return mixed The valid flexform pointer array or FALSE if it was not valid
* @access public
*/
function flexform_getValidPointer ($flexformPointer) {
if (is_string($flexformPointer)) $flexformPointer = $this->flexform_getPointerFromString ($flexformPointer);
if (!t3lib_div::inList($this->rootTable.',tt_content',$flexformPointer['table'])) {
if ($this->debug) t3lib_div::devLog ('flexform_getValidPointer: Table "'.$flexformPointer['table'].'" is not in the list of allowed tables!', 'TemplaVoila API', 2, $this->rootTable.',tt_content');
return FALSE;
}
if (!$destinationRecord = t3lib_BEfunc::getRecordWSOL($flexformPointer['table'], $flexformPointer['uid'],'uid,pid,tx_templavoila_flex')) {
if ($this->debug) t3lib_div::devLog ('flexform_getValidPointer: Pointer destination record not found!', 'TemplaVoila API', 2, $flexformPointer);
return FALSE;
}
if ($flexformPointer['position'] > 0) {
$elementReferencesArr = $this->flexform_getElementReferencesFromXML ($destinationRecord['tx_templavoila_flex'], $flexformPointer);
if (!isset ($elementReferencesArr[$flexformPointer['position']]) && $flexformPointer['position'] != -1) {
if ($this->debug) t3lib_div::devLog ('flexform_getValidPointer: The position in the specified flexform pointer does not exist!', 'TemplaVoila API', 2, $flexformPointer);
return FALSE;
}
if (isset ($flexformPointer['targetCheckUid']) && $elementReferencesArr[$flexformPointer['position']] != $flexformPointer['targetCheckUid']) {
if ($this->debug) t3lib_div::devLog ('flexform_getValidPointer: The target record uid does not match the targetCheckUid!', 'TemplaVoila API', 2, array ($flexformPointer, $elementReferencesArr));
return FALSE;
}
}
return $flexformPointer;
}
/**
* Converts a string of the format "table:uid:sheet:sLang:field:vLang:position/targettable:targetuid" into a flexform
* pointer array.
*
* NOTE: "targettable" currently must be tt_content
*
* @param string $flexformPointerString: A string of the format "table:uid:sheet:sLang:field:vLang:position". The string may additionally contain "/table:uid" which is used to check the target record of the pointer
* @return array A flexform pointer array which can be used with the functions in tx_templavoila_api
* @access public
*/
function flexform_getPointerFromString ($flexformPointerString) {
$tmpArr = explode ('/', $flexformPointerString);
$locationString= $tmpArr[0];
$targetCheckString = $tmpArr[1];
$locationArr = explode (':', $locationString);
$targetCheckArr = explode (':', $targetCheckString);
if (count($targetCheckArr) == 2) {
$flexformPointer = array (
'table' => $locationArr[0],
'uid' => $locationArr[1]
);
} else {
$flexformPointer = array (
'table' => $locationArr[0],
'uid' => $locationArr[1],
'sheet' => $locationArr[2],
'sLang' => $locationArr[3],
'field' => $locationArr[4],
'vLang' => $locationArr[5],
'position' => $locationArr[6],
'targetCheckUid' => $targetCheckArr[1],
);
}
return $flexformPointer;
}
/**
* Converts a flexform pointer array to a string of the format "table:uid:sheet:sLang:field:vLang:position/targettable:targetuid"
*
* NOTE: "targettable" currently must be tt_content
*
* @param array $flexformPointer: A valid flexform pointer array
* @return mixed A string of the format "table:uid:sheet:sLang:field:vLang:position". The string might additionally contain "/table:uid" which is used to check the target record of the pointer. If an error occurs: FALSE
* @access public
*/
function flexform_getStringFromPointer ($flexformPointer) {
if (!is_array ($flexformPointer)) return FALSE;
if (isset ($flexformPointer['sheet'])) {
$flexformPointerString =
$flexformPointer['table'].':'.
$flexformPointer['uid'].':'.
$flexformPointer['sheet'].':'.
$flexformPointer['sLang'].':'.
$flexformPointer['field'].':'.
$flexformPointer['vLang'].':'.
$flexformPointer['position'];
if (isset ($flexformPointer['targetCheckUid'])) {
$flexformPointerString .= '/tt_content:'.$flexformPointer['targetCheckUid'];
}
} else {
$flexformPointerString = $flexformPointer['table'].':'.$flexformPointer['uid'];
}
return $flexformPointerString;
}
/**
* Returns a tt_content record specified by a flexform pointer. The flexform pointer may be an
* array or a string. As always with flexform pointers, if only "table" and "uid" are set, it
* specifies the record directly, but if sheet, sLang etc. are set, it specifies the location
* from the perspective of the parent element.
*
* @param mixed $flexformPointer: A flexform pointer referring to the content element. Although an array is preferred, you may also pass a string which will be converted automatically by flexform_getPointerFromString()
* @return mixed The record row or FALSE if not successful
* @access public
*/
function flexform_getRecordByPointer ($flexformPointer) {
if (is_string($flexformPointer)) $flexformPointer = $this->flexform_getPointerFromString ($flexformPointer);
if (!$flexformPointer = $this->flexform_getValidPointer ($flexformPointer)) return FALSE;
if (isset ($flexformPointer['sheet'])) {
if (!$parentRecord = t3lib_BEfunc::getRecordWSOL($flexformPointer['table'], $flexformPointer['uid'],'uid,tx_templavoila_flex')) return FALSE;
$elementReferencesArr = $this->flexform_getElementReferencesFromXML ($parentRecord['tx_templavoila_flex'], $flexformPointer); // This should work, because both flexFormPointer and tx_templavoila_flex will be based on any workspace overlaid record.
return t3lib_BEfunc::getRecordWSOL('tt_content', $elementReferencesArr[$flexformPointer['position']]);
} else {
return t3lib_BEfunc::getRecordWSOL('tt_content', $flexformPointer['uid']);
}
}
/**
* Returns an array of flexform pointers pointing to all occurrences of a tt_content record with uid $recordUid
* on the page with uid $pageUid.
*
* @param integer $elementUid: UID of a tt_content record
* @param integer $pageUid: UID of the page to search in
* @return array Array of flexform pointers
* @access public
*/
function flexform_getPointersByRecord ($elementUid, $pageUid) {
$dummyArr = array();
$flexformPointersArr = $this->flexform_getFlexformPointersToSubElementsRecursively('pages', $pageUid, $dummyArr);
$resultPointersArr = array();
if (is_array ($flexformPointersArr)) {
foreach ($flexformPointersArr as $flexformPointerArr) {
if ($flexformPointerArr['targetCheckUid'] == $elementUid) {
$resultPointersArr[] = $flexformPointerArr;
}
}
}
return $resultPointersArr;
}
/**
* Takes FlexForm XML content in and based on the flexform pointer it will find a list of references, parse them
* and return them as an array of tt_content uids. This function automatically checks if the tt_content records
* really exist and are not marked as deleted - those who are will be filtered out.
*
* @param string $flexformXML: XML content of a flexform field
* @param array $flexformPointer: Pointing to a field in the XML structure to get the list of element references from.
* @return mixed Numerical array tt_content uids or FALSE if an error occurred (eg. flexformXML was no valid XML)
* @access public
*/
function flexform_getElementReferencesFromXML($flexformXML, $flexformPointer) {
// Getting value of the field containing the relations:
$flexformXMLArr = t3lib_div::xml2array($flexformXML);
if (!is_array ($flexformXMLArr) && strlen($flexformXML) > 0) {
if ($this->debug) t3lib_div::devLog ('flexform_getReferencesToElementsFromXML: flexformXML seems to be no valid XML. Parser error message: '.$flexformXMLArr, 'TemplaVoila API', 2, $flexformXML);
return FALSE;
}
$listOfUIDs = is_array ($flexformXMLArr) && is_array($flexformXMLArr['data']) ? $flexformXMLArr['data'][$flexformPointer['sheet']][$flexformPointer['sLang']][$flexformPointer['field']][$flexformPointer['vLang']] : '';
$arrayOfUIDs = t3lib_div::intExplode(',', $listOfUIDs);
// Getting the relation uids out and use only tt_content records which are not deleted:
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->start($listOfUIDs, 'tt_content');
$dbAnalysis->getFromDB();
$elementReferencesArr = array();
$counter = 1;
foreach ($arrayOfUIDs as $uid) {
if (is_array($dbAnalysis->results['tt_content'][$uid])) {
$elementReferencesArr[$counter] = $uid;
$counter++;
}
}
return $elementReferencesArr;
}
/**
* Returns an array of uids of all sub elements of the element specified by $table and $uid.
*
* @param string $table: Name of the table of the parent element ('pages' or 'tt_content')
* @param integer $uid: UID of the parent element
* @param array $recordUids: Array of record UIDs - used internally, don't touch (but pass an empty array)
* @param integer $recursionDepth: Tracks the current level of recursion - used internall, don't touch.
* @return array Array of record UIDs
* @access public
*/
function flexform_getListOfSubElementUidsRecursively ($table, $uid, &$recordUids, $recursionDepth=0) {
if (!is_array($recordUids)) $recordUids = array();
$parentRecord = t3lib_BEfunc::getRecordWSOL($table, $uid, 'uid,pid,tx_templavoila_ds,tx_templavoila_flex');
$flexFieldArr = t3lib_div::xml2array($parentRecord['tx_templavoila_flex']);
$expandedDataStructure = $this->ds_getExpandedDataStructure ($table, $parentRecord);
if (is_array ($flexFieldArr['data'])) {
foreach ($flexFieldArr['data'] as $sheetKey => $languagesArr) {
if (is_array ($languagesArr)) {
foreach ($languagesArr as $fieldsArr) {
if (is_array ($fieldsArr)) {
foreach ($fieldsArr as $fieldName => $valuesArr) {
if (is_array ($valuesArr)) {
foreach ($valuesArr as $value) {
if ($expandedDataStructure[$sheetKey]['ROOT']['el'][$fieldName]['tx_templavoila']['eType'] == 'ce') {
$valueItems = t3lib_div::intExplode (',', $value);
if (is_array($valueItems)) {
foreach ($valueItems as $subElementUid) {
if ($subElementUid > 0) {
$recordUids[] = $subElementUid;
if ($recursionDepth < 100) {
$this->flexform_getListOfSubElementUidsRecursively ('tt_content', $subElementUid, $recordUids, $recursionDepth+1);
}
}
}
}
}
}
}
}
}
}
}
}
}
return $recordUids;
}
/**
* Returns an array of flexform pointers to all sub elements of the element specified by $table and $uid.
*
* @param string $table: Name of the table of the parent element ('pages' or 'tt_content')
* @param integer $uid: UID of the parent element
* @param array $flexformPointers: Array of flexform pointers - used internally, don't touch
* @param integer $recursionDepth: Tracks the current level of recursion - used internall, don't touch.
* @return array Array of flexform pointers
* @access public
*/
function flexform_getFlexformPointersToSubElementsRecursively ($table, $uid, &$flexformPointers, $recursionDepth=0) {
if (!is_array($flexformPointers)) $flexformPointers = array();
$parentRecord = t3lib_BEfunc::getRecordWSOL($table, $uid, 'uid,pid,tx_templavoila_flex,tx_templavoila_ds,tx_templavoila_to');
$flexFieldArr = t3lib_div::xml2array($parentRecord['tx_templavoila_flex']);
$expandedDataStructure = $this->ds_getExpandedDataStructure ($table, $parentRecord);
if (is_array ($flexFieldArr['data'])) {
foreach ($flexFieldArr['data'] as $sheetKey => $languagesArr) {
if (is_array ($languagesArr)) {
foreach ($languagesArr as $languageKey=> $fieldsArr) {
if (is_array ($fieldsArr)) {
foreach ($fieldsArr as $fieldName => $valuesArr) {
if (is_array ($valuesArr)) {
foreach ($valuesArr as $valueName => $value) {
if ($expandedDataStructure[$sheetKey]['ROOT']['el'][$fieldName]['tx_templavoila']['eType'] == 'ce') {
$valueItems = t3lib_div::intExplode (',', $value);
if (is_array($valueItems)) {
$position = 1;
foreach ($valueItems as $subElementUid) {
if ($subElementUid > 0) {
$flexformPointers[] = array (
'table' => $table,
'uid' => $uid,
'sheet' => $sheetKey,
'sLang' => $languageKey,
'field' => $fieldName,
'vLang' => $valueName,
'position' => $position,
'targetCheckUid' => $subElementUid
);
if ($recursionDepth < 100) {
$this->flexform_getFlexformPointersToSubElementsRecursively ('tt_content', $subElementUid, $flexformPointers, $recursionDepth+1);
}
$position ++;
}
}
}
}
}
}
}
}
}
}
}
}
return $flexformPointers;
}
/******************************************************
*
* Flexform helper functions (protected)
*
******************************************************/
/**