Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "childs" to "children" #6620

Merged
merged 5 commits into from Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
90 changes: 45 additions & 45 deletions core-bundle/assets/scripts/core.js
Expand Up @@ -1199,12 +1199,12 @@ window.Backend =
tbody = table.getElement('tbody'),
makeSortable = function(tbody) {
var rows = tbody.getChildren(),
textarea, childs, i, j;
textarea, children, i, j;

for (i=0; i<rows.length; i++) {
childs = rows[i].getChildren();
for (j=0; j<childs.length; j++) {
if (textarea = childs[j].getFirst('textarea')) {
children = rows[i].getChildren();
for (j=0; j<children.length; j++) {
if (textarea = children[j].getFirst('textarea')) {
textarea.name = textarea.name.replace(/\[[0-9]+][[0-9]+]/g, '[' + i + '][' + j + ']')
}
}
Expand All @@ -1221,7 +1221,7 @@ window.Backend =
},
addEventsTo = function(tr) {
var head = thead.getFirst('tr'),
command, textarea, current, next, ntr, childs, index, i;
command, textarea, current, next, ntr, children, index, i;

tr.getElements('button').each(function(bt) {
if (bt.hasEvent('click')) return;
Expand All @@ -1232,10 +1232,10 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
ntr = new Element('tr');
childs = tr.getChildren();
for (i=0; i<childs.length; i++) {
next = childs[i].clone(true).inject(ntr, 'bottom');
if (textarea = childs[i].getFirst('textarea')) {
children = tr.getChildren();
for (i=0; i<children.length; i++) {
next = children[i].clone(true).inject(ntr, 'bottom');
if (textarea = children[i].getFirst('textarea')) {
next.getFirst('textarea').value = textarea.value;
}
}
Expand All @@ -1257,9 +1257,9 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
index = getIndex(bt);
childs = tbody.getChildren();
for (i=0; i<childs.length; i++) {
current = childs[i].getChildren()[index];
children = tbody.getChildren();
for (i=0; i<children.length; i++) {
current = children[i].getChildren()[index];
next = current.clone(true).inject(current, 'after');
if (textarea = current.getFirst('textarea')) {
next.getFirst('textarea').value = textarea.value;
Expand All @@ -1276,16 +1276,16 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
index = getIndex(bt);
childs = tbody.getChildren();
children = tbody.getChildren();
if (index > 0) {
for (i=0; i<childs.length; i++) {
current = childs[i].getChildren()[index];
for (i=0; i<children.length; i++) {
current = children[i].getChildren()[index];
current.inject(current.getPrevious(), 'before');
}
} else {
for (i=0; i<childs.length; i++) {
current = childs[i].getChildren()[index];
current.inject(childs[i].getLast(), 'before');
for (i=0; i<children.length; i++) {
current = children[i].getChildren()[index];
current.inject(children[i].getLast(), 'before');
}
}
makeSortable(tbody);
Expand All @@ -1295,16 +1295,16 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
index = getIndex(bt);
childs = tbody.getChildren();
children = tbody.getChildren();
if (index < (tr.getChildren().length - 2)) {
for (i=0; i<childs.length; i++) {
current = childs[i].getChildren()[index];
for (i=0; i<children.length; i++) {
current = children[i].getChildren()[index];
current.inject(current.getNext(), 'after');
}
} else {
for (i=0; i<childs.length; i++) {
current = childs[i].getChildren()[index];
current.inject(childs[i].getFirst(), 'before');
for (i=0; i<children.length; i++) {
current = children[i].getChildren()[index];
current.inject(children[i].getFirst(), 'before');
}
}
makeSortable(tbody);
Expand All @@ -1314,10 +1314,10 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
index = getIndex(bt);
childs = tbody.getChildren();
children = tbody.getChildren();
if (tr.getChildren().length > 2) {
for (i=0; i<childs.length; i++) {
childs[i].getChildren()[index].destroy();
for (i=0; i<children.length; i++) {
children[i].getChildren()[index].destroy();
}
head.getFirst('td').destroy();
}
Expand Down Expand Up @@ -1425,12 +1425,12 @@ window.Backend =
tbody = table.getElement('tbody'),
makeSortable = function(tbody) {
var rows = tbody.getChildren(),
childs, i, j, input;
children, i, j, input;

for (i=0; i<rows.length; i++) {
childs = rows[i].getChildren();
for (j=0; j<childs.length; j++) {
if (input = childs[j].getFirst('input')) {
children = rows[i].getChildren();
for (j=0; j<children.length; j++) {
if (input = children[j].getFirst('input')) {
input.name = input.name.replace(/\[[0-9]+]/g, '[' + i + ']');
if (input.type == 'checkbox') {
input.id = input.name.replace(/\[[0-9]+]/g, '').replace(/\[/g, '_').replace(/]/g, '') + '_' + i;
Expand All @@ -1450,7 +1450,7 @@ window.Backend =
});
},
addEventsTo = function(tr) {
var command, input, next, ntr, childs, i;
var command, input, next, ntr, children, i;
tr.getElements('button').each(function(bt) {
if (bt.hasEvent('click')) return;
command = bt.getProperty('data-command');
Expand All @@ -1460,10 +1460,10 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
ntr = new Element('tr');
childs = tr.getChildren();
for (i=0; i<childs.length; i++) {
next = childs[i].clone(true).inject(ntr, 'bottom');
if (input = childs[i].getFirst('input')) {
children = tr.getChildren();
for (i=0; i<children.length; i++) {
next = children[i].clone(true).inject(ntr, 'bottom');
if (input = children[i].getFirst('input')) {
next.getFirst('input').value = input.value;
if (input.type == 'checkbox') {
next.getFirst('input').checked = input.checked ? 'checked' : '';
Expand Down Expand Up @@ -1528,12 +1528,12 @@ window.Backend =
tbody = table.getElement('tbody'),
makeSortable = function(tbody) {
var rows = tbody.getChildren(),
childs, i, j, input;
children, i, j, input;

for (i=0; i<rows.length; i++) {
childs = rows[i].getChildren();
for (j=0; j<childs.length; j++) {
if (input = childs[j].getFirst('input')) {
children = rows[i].getChildren();
for (j=0; j<children.length; j++) {
if (input = children[j].getFirst('input')) {
input.name = input.name.replace(/\[[0-9]+]/g, '[' + i + ']')
}
}
Expand All @@ -1549,7 +1549,7 @@ window.Backend =
});
},
addEventsTo = function(tr) {
var command, input, next, ntr, childs, i;
var command, input, next, ntr, children, i;
tr.getElements('button').each(function(bt) {
if (bt.hasEvent('click')) return;
command = bt.getProperty('data-command');
Expand All @@ -1559,10 +1559,10 @@ window.Backend =
bt.addEvent('click', function() {
Backend.getScrollOffset();
ntr = new Element('tr');
childs = tr.getChildren();
for (i=0; i<childs.length; i++) {
next = childs[i].clone(true).inject(ntr, 'bottom');
if (input = childs[i].getFirst('input')) {
children = tr.getChildren();
for (i=0; i<children.length; i++) {
next = children[i].clone(true).inject(ntr, 'bottom');
if (input = children[i].getFirst('input')) {
next.getFirst().value = input.value;
}
}
Expand Down
6 changes: 3 additions & 3 deletions core-bundle/contao/dca/tl_page.php
Expand Up @@ -109,10 +109,10 @@
'attributes' => 'onclick="Backend.getScrollOffset()"',
'button_callback' => array('tl_page', 'copyPage')
),
'copyChilds' => array
'copyChildren' => array
(
'href' => 'act=paste&amp;mode=copy&amp;childs=1',
'icon' => 'copychilds.svg',
'href' => 'act=paste&amp;mode=copy&amp;children=1',
'icon' => 'copychildren.svg',
'attributes' => 'onclick="Backend.getScrollOffset()"',
'button_callback' => array('tl_page', 'copyPageWithSubpages')
),
Expand Down
12 changes: 11 additions & 1 deletion core-bundle/contao/drivers/DC_Folder.php
Expand Up @@ -303,12 +303,22 @@ public function showAll()
$this->isValid($this->intId);
}

$children = Input::get('children');

// Backwards compatibility
if (Input::get('childs') !== null)
{
trigger_deprecation('contao/core-bundle', '5.3', 'Using the "childs" query parameter has been deprecated and will no longer work in Contao 6. Use the "children" parameter instead.');
$children = Input::get('childs');
}

$arrClipboard = $objSession->get('CLIPBOARD');

$arrClipboard[$this->strTable] = array
(
'id' => $this->urlEncode($this->intId),
'childs' => Input::get('childs'),
'childs' => $children, // backwards compatibility
'children' => $children,
'mode' => $mode
);

Expand Down