AdminPageFramework_Form_View___Fieldset_Base::_getRepeaterFieldEnablerScript PHP Метод

_getRepeaterFieldEnablerScript() защищенный Метод

protected _getRepeaterFieldEnablerScript ( $sFieldsContainerID, $iFieldCount, $aSettings )
    protected function _getRepeaterFieldEnablerScript($sFieldsContainerID, $iFieldCount, $aSettings)
    {
        $_sSmallButtons = '"' . $this->_getRepeatableButtonHTML($sFieldsContainerID, (array) $aSettings, $iFieldCount, true) . '"';
        $_sNestedFieldsButtons = '"' . $this->_getRepeatableButtonHTML($sFieldsContainerID, (array) $aSettings, $iFieldCount, false) . '"';
        $_aJSArray = json_encode($aSettings);
        $_sScript = <<<JAVASCRIPTS
jQuery( document ).ready( function() {
    var _oButtonPlaceHolders = jQuery( '#{$sFieldsContainerID} > .admin-page-framework-field.without-child-fields .repeatable-field-buttons' );
    /* If the button place-holder is set in the field type definition, replace it with the created output */
    if ( _oButtonPlaceHolders.length > 0 ) {
        _oButtonPlaceHolders.replaceWith( {$_sSmallButtons} );
    } 
    /* Otherwise, insert the button element at the beginning of the field tag */
    else { 
        /**
         * Adds the buttons
         * Check whether the button container already exists for WordPress 3.5.1 or below.
         * @todo 3.8.0 Examine the below conditional line whether the behavior does not break for nested fields.
         */
        if ( ! jQuery( '#{$sFieldsContainerID} .admin-page-framework-repeatable-field-buttons' ).length ) { 
            jQuery( '#{$sFieldsContainerID} > .admin-page-framework-field.without-nested-fields' ).prepend( {$_sSmallButtons} );
        }
        /**
         * Support for nested fields.
         * For nested fields, add the buttons to the fields tag.
         */
        jQuery( '#{$sFieldsContainerID} > .admin-page-framework-field.with-nested-fields' ).prepend( {$_sNestedFieldsButtons} );
        
        /**
         * Support for inline mixed fields.
         */
        // jQuery( '#{$sFieldsContainerID} > .admin-page-framework-field.with-mixed-fields' ).prepend( {$_sNestedFieldsButtons} );
        
    }     
    jQuery( '#{$sFieldsContainerID}' ).updateAdminPageFrameworkRepeatableFields( {$_aJSArray} ); // Update the fields     
});
JAVASCRIPTS;
        return "<script type='text/javascript'>" . '/* <![CDATA[ */' . $_sScript . '/* ]]> */' . "</script>";
    }