Skip to content

Commit

Permalink
fixes #1230
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Apr 1, 2017
1 parent ecb6cbf commit 9932d5d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions controls/repeater/repeater.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*jshint -W065 */
var RepeaterRow = function( rowIndex, container, label ) {
var RepeaterRow = function( rowIndex, container, label, control ) {

'use strict';

var self = this;

this.rowIndex = rowIndex;
this.container = container;
this.label = label;
Expand Down Expand Up @@ -56,6 +55,17 @@ var RepeaterRow = function( rowIndex, container, label ) {
if ( 'function' === typeof rowLabelField.val ) {
rowLabel = rowLabelField.val();
if ( '' !== rowLabel ) {
if ( 'undefined' !== typeof control.params.fields[ this.label.field ] ) {
if ( 'undefined' !== typeof control.params.fields[ this.label.field ].type ) {
if ( 'select' === control.params.fields[ this.label.field ].type ) {
if ( 'undefined' !== typeof control.params.fields[ this.label.field ].choices ) {
if ( 'undefined' !== typeof control.params.fields[ this.label.field ].choices[ rowLabelField.val() ] ) {
rowLabel = control.params.fields[ this.label.field ].choices[ rowLabelField.val() ];
}
}
}
}
}
this.header.find( '.repeater-row-label' ).text( rowLabel );
return;
}
Expand Down Expand Up @@ -662,7 +672,8 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({
newRow = new RepeaterRow(
control.currentIndex,
jQuery( template ).appendTo( control.repeaterFieldsContainer ),
control.params.row_label
control.params.row_label,
control
);

newRow.container.on( 'row:remove', function( e, rowIndex ) {
Expand Down

0 comments on commit 9932d5d

Please sign in to comment.