protected function getField($aField) { $this->_sCheckboxClassSelector = ''; $aField['label'] = $this->_getPostTypeArrayForChecklist(isset($aField['slugs_to_remove']) ? $this->getAsArray($aField['slugs_to_remove']) : $this->aDefaultRemovingPostTypeSlugs, $aField['query'], $aField['operator']); return parent::getField($aField); }
protected function getScripts() { $_aJSArray = json_encode($this->aFieldTypeSlugs); return parent::getScripts() . <<<JAVASCRIPTS /* For tabs */ var enableAPFTabbedBox = function( nodeTabBoxContainer ) { jQuery( nodeTabBoxContainer ).each( function() { jQuery( this ).find( '.tab-box-tab' ).each( function( i ) { if ( 0 === i ) { jQuery( this ).addClass( 'active' ); } jQuery( this ).click( function( e ){ // Prevents jumping to the anchor which moves the scroll bar. e.preventDefault(); // Remove the active tab and set the clicked tab to be active. jQuery( this ).siblings( 'li.active' ).removeClass( 'active' ); jQuery( this ).addClass( 'active' ); // Find the element id and select the content element with it. var thisTab = jQuery( this ).find( 'a' ).attr( 'href' ); active_content = jQuery( this ).closest( '.tab-box-container' ).find( thisTab ).css( 'display', 'block' ); active_content.siblings().css( 'display', 'none' ); }); }); }); }; jQuery( document ).ready( function() { enableAPFTabbedBox( jQuery( '.tab-box-container' ) ); /* The repeatable event */ jQuery().registerAPFCallback( { /** * The repeatable field callback for the add event. * * @param object node * @param string the field type slug * @param string the field container tag ID * @param integer the caller type. 1 : repeatable sections. 0 : repeatable fields. */ added_repeatable_field: function( oClonedField, sFieldType, sFieldTagID, iCallType ) { /* If it is not the color field type, do nothing. */ if ( jQuery.inArray( sFieldType, {$_aJSArray} ) <= -1 ) { return; } oClonedField.nextAll().andSelf().each( function() { jQuery( this ).find( 'div' ).incrementIDAttribute( 'id' ); jQuery( this ).find( 'li.tab-box-tab a' ).incrementIDAttribute( 'href' ); jQuery( this ).find( 'li.category-list' ).incrementIDAttribute( 'id' ); enableAPFTabbedBox( jQuery( this ).find( '.tab-box-container' ) ); }); }, /** * The repeatable field callback for the remove event. * * @param object the field container element next to the removed field container. * @param string the field type slug * @param string the field container tag ID * @param integer the caller type. 1 : repeatable sections. 0 : repeatable fields. */ removed_repeatable_field: function( oNextFieldConainer, sFieldType, sFieldTagID, iCallType ) { /* If it is not the color field type, do nothing. */ if ( jQuery.inArray( sFieldType, {$_aJSArray} ) <= -1 ) { return; } oNextFieldConainer.nextAll().andSelf().each( function() { jQuery( this ).find( 'div' ).decrementIDAttribute( 'id' ); jQuery( this ).find( 'li.tab-box-tab a' ).decrementIDAttribute( 'href' ); jQuery( this ).find( 'li.category-list' ).decrementIDAttribute( 'id' ); }); } }); }); JAVASCRIPTS; }