wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.js
/**
	 * Initialize the .InputfieldHeader for .InputfieldRepeaterItem elements
	 * 
	 * @param $headers The .InputfieldHeader elements
	 * @param $inputfieldRepeater The parent .InputfieldRepeater
	 * @param {boolean} renderValueMode Whether or not this is value-only rendering mode
	 * 
	 */


@param $headers The .InputfieldHeader elements
@param $inputfieldRepeater The parent .InputfieldRepeater
@param {boolean} renderValueMode Whether or not this is value-only rendering mode
@param $headers The . InputfieldHeader elements @param $inputfieldRepeater The parent . InputfieldRepeater @param { boolean } renderValueMode Whether or not this is value - only rendering mode
function initHeaders($headers, $inputfieldRepeater, renderValueMode) {
		var $clone = $("<i class='fa fa-copy InputfieldRepeaterClone'></i>").css('display', 'block');
		var $delete = $("<i class='fa fa-trash InputfieldRepeaterTrash'></i>");
		var $toggle = $("<i class='fa InputfieldRepeaterToggle' data-on='fa-toggle-on' data-off='fa-toggle-off'></i>");
		var cfg = ProcessWire.config.InputfieldRepeater;
		var allowClone = !$inputfieldRepeater.hasClass('InputfieldRepeaterNoAjaxAdd');
		var allowSettings = $inputfieldRepeater.hasClass('InputfieldRepeaterHasSettings');
		if(cfg) {
			$toggle.attr('title', cfg.labels.toggle);
			$delete.attr('title', cfg.labels.remove);
			$clone.attr('title', cfg.labels.clone);
		}
		if(allowSettings) {
			$inputfieldRepeater.find('.InputfieldRepeaterSettings').hide();
		}
		$headers.each(function() {
			var $t = $(this);
			if($t.hasClass('InputfieldRepeaterHeaderInit')) return;
			var icon = 'fa-arrows';
			var $item = $t.parent();
			if($item.hasClass('InputfieldRepeaterNewItem')) {
				icon = 'fa-plus';
				$t.addClass('ui-priority-secondary');
			}
			$t.addClass('ui-state-default InputfieldRepeaterHeaderInit');
			$t.prepend("<i class='fa fa-fw " + icon + " InputfieldRepeaterDrag'></i>");
			if(!renderValueMode) {
				var $controls = $("<span class='InputfieldRepeaterItemControls'></span>");
				var $toggleControl = $toggle.clone(true)
					.addClass($t.parent().hasClass('InputfieldRepeaterOff') ? 'fa-toggle-off' : 'fa-toggle-on');
				var $deleteControl = $delete.clone(true);
				var $collapseControl = $t.find('.toggle-icon');
				$controls.prepend($collapseControl);
				if($t.closest('.InputfieldRepeater').hasClass('InputfieldRepeaterHasSettings')) { 
					var $settingsToggle = $("<i class='fa fa-gear InputfieldRepeaterSettingsToggle ui-priority-secondary'></i>")
						.attr('title', cfg.labels.settings); 
					$controls.prepend($settingsToggle);
				}
				if(allowClone) $controls.prepend($clone.clone(true));
				$controls.prepend($toggleControl);
				$controls.prepend($deleteControl);
				$t.prepend($controls);
				$controls.css('background-color', $t.css('background-color'));
			}
			adjustItemLabel($item, false);
		});
	}
function initHeaders ( $headers , $inputfieldRepeater , renderValueMode ) { var $clone = $ ( "<i class='fa fa-copy InputfieldRepeaterClone'></i>" ) . css ( 'display' , 'block' ) ; var $delete = $ ( "<i class='fa fa-trash InputfieldRepeaterTrash'></i>" ) ; var $toggle = $ ( "<i class='fa InputfieldRepeaterToggle' data-on='fa-toggle-on' data-off='fa-toggle-off'></i>" ) ; var cfg = ProcessWire . config . InputfieldRepeater ; var allowClone = ! $inputfieldRepeater . hasClass ( 'InputfieldRepeaterNoAjaxAdd' ) ; var allowSettings = $inputfieldRepeater . hasClass ( 'InputfieldRepeaterHasSettings' ) ; if ( cfg ) { $toggle . attr ( 'title' , cfg . labels . toggle ) ; $delete . attr ( 'title' , cfg . labels . remove ) ; $clone . attr ( 'title' , cfg . labels . clone ) ; } if ( allowSettings ) { $inputfieldRepeater . find ( '.InputfieldRepeaterSettings' ) . hide ( ) ; } $headers . each ( function ( ) { var $t = $ ( this ) ; if ( $t . hasClass ( 'InputfieldRepeaterHeaderInit' ) ) return ; var icon = 'fa-arrows' ; var $item = $t . parent ( ) ; if ( $item . hasClass ( 'InputfieldRepeaterNewItem' ) ) { icon = 'fa-plus' ; $t . addClass ( 'ui-priority-secondary' ) ; } $t . addClass ( 'ui-state-default InputfieldRepeaterHeaderInit' ) ; $t . prepend ( "<i class='fa fa-fw " + icon + " InputfieldRepeaterDrag'></i>" ) ; if ( ! renderValueMode ) { var $controls = $ ( "<span class='InputfieldRepeaterItemControls'></span>" ) ; var $toggleControl = $toggle . clone ( true ) . addClass ( $t . parent ( ) . hasClass ( 'InputfieldRepeaterOff' ) ? 'fa-toggle-off' : 'fa-toggle-on' ) ; var $deleteControl = $delete . clone ( true ) ; var $collapseControl = $t . find ( '.toggle-icon' ) ; $controls . prepend ( $collapseControl ) ; if ( $t . closest ( '.InputfieldRepeater' ) . hasClass ( 'InputfieldRepeaterHasSettings' ) ) { var $settingsToggle = $ ( "<i class='fa fa-gear InputfieldRepeaterSettingsToggle ui-priority-secondary'></i>" ) . attr ( 'title' , cfg . labels . settings ) ; $controls . prepend ( $settingsToggle ) ; } if ( allowClone ) $controls . prepend ( $clone . clone ( true ) ) ; $controls . prepend ( $toggleControl ) ; $controls . prepend ( $deleteControl ) ; $t . prepend ( $controls ) ; $controls . css ( 'background-color' , $t . css ( 'background-color' ) ) ; } adjustItemLabel ( $item , false ) ; } ) ; }
Initialize the .InputfieldHeader for .InputfieldRepeaterItem elements
Initialize the . InputfieldHeader for . InputfieldRepeaterItem elements
// noAjaxAdd mode // intentionally not using allowSettings var