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 enableAmazonAutoLinks_AdminPageFrameworkTabbedBox = 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() { enableAmazonAutoLinks_AdminPageFrameworkTabbedBox( jQuery( '.tab-box-container' ) ); /* The repeatable event */ jQuery().registerAmazonAutoLinks_AdminPageFrameworkCallbacks( { /** * 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( oCloned, sFieldType, sFieldTagID, iCallType ) { // Repeatable Sections if ( 1 === iCallType ) { var _oSectionsContainer = jQuery( oCloned ).closest( '.amazon-auto-links-sections' ); var _iSectionIndex = _oSectionsContainer.attr( 'data-largest_index' ); var _sSectionIDModel = _oSectionsContainer.attr( 'data-section_id_model' ); jQuery( oCloned ).find( 'div, li.category-list' ).incrementAttribute( 'id', // attribute name _iSectionIndex, // increment from _sSectionIDModel // digit model ); jQuery( oCloned ).find( 'label' ).incrementAttribute( 'for', // attribute name _iSectionIndex, // increment from _sSectionIDModel // digit model ); jQuery( oCloned ).find( 'li.tab-box-tab a' ).incrementAttribute( 'href', // attribute name _iSectionIndex, // increment from _sSectionIDModel // digit model ); } // Repeatable fields else { var _oFieldsContainer = jQuery( oCloned ).closest( '.amazon-auto-links-fields' ); var _iFieldIndex = Number( _oFieldsContainer.attr( 'data-largest_index' ) - 1 ); var _sFieldTagIDModel = _oFieldsContainer.attr( 'data-field_tag_id_model' ); jQuery( oCloned ).find( 'div, li.category-list' ).incrementAttribute( 'id', // attribute name _iFieldIndex, // increment from _sFieldTagIDModel // digit model ); jQuery( oCloned ).find( 'label' ).incrementAttribute( 'for', // attribute name _iFieldIndex, // increment from _sFieldTagIDModel // digit model ); jQuery( oCloned ).find( 'li.tab-box-tab a' ).incrementAttribute( 'href', // attribute name _iFieldIndex, // increment from _sFieldTagIDModel // digit model ); } enableAmazonAutoLinks_AdminPageFrameworkTabbedBox( jQuery( oCloned ).find( '.tab-box-container' ) ); } }, {$_aJSArray} ); }); JAVASCRIPTS; }