function _post_submitbox_misc_actions()

in web/wp-content/plugins/acf-extended/includes/module-legacy.php [254:558]


    function _post_submitbox_misc_actions($post){
        
        $status = $post->post_status === 'publish' || $post->post_status === 'auto-draft' ? __("Active",'acf') : __("Inactive",'acf');
        $name = $this->get_name($post->ID);
        
        $tools = array();
        
        foreach($this->tools as $action){
            
            $action_name = $action === 'php' ? 'PHP' : 'Json';
            $tools[] = '<a href="' . admin_url("edit.php?post_type=acf-field-group&page=acf-tools&tool={$this->tool}&action={$action}&keys={$name}") . '">' . $action_name . '</a>';
            
        }
        
        if($tools){ ?>
        <div class="misc-pub-section acfe-misc-export">
            <span class="dashicons dashicons-editor-code"></span>
            Export: <?php echo implode(' ', $tools); ?>
        </div>
        <?php } ?>
        <script type="text/javascript">
            (function($) {
                $('#post-status-display').html('<?php echo $status; ?>');
                <?php if($tools){ ?>$('.acfe-misc-export').insertAfter('.misc-pub-post-status');<?php } ?>
            })(jQuery);
        </script>
        <?php
        
        $this->post_submitbox_misc_actions($post);
        
    }
    
    function post_submitbox_misc_actions($post){
        // ...
    }
    
    /*
     * Post Enter Title Here
     */
    function post_enter_title_here($placeholder, $post){
        return $this->label;
    }
    
    /*
     * Post Footer
     */
    function _post_footer(){
        
        ?>
        <script type="text/javascript">
        (function($){

            $('#post').submit(function(e){

                // vars
                var $title = $('#titlewrap #title');

                // empty
                if($title.val()) return;
                
                e.preventDefault();
                
                alert('<?php echo $this->label; ?> is required.');
                
                $title.focus();
            });

        })(jQuery);
        </script>
        <?php
    
        $this->post_footer();
        
    }
    
    function post_footer(){
        // ...
    }
    
    function _edit_head(){
        
        // enqueue acf global js for tooltips
        acf_enqueue_script('acf');
    }
    
    /*
     * Edit Columns
     */
    function _edit_columns($columns){
        
        if(empty($this->columns)){
            return $columns;
        }
    
        $columns = array_merge(array('cb' => $columns['cb'], 'title' => $columns['title']), $this->columns);
        
        return $this->edit_columns($columns);
        
    }
    
    function edit_columns($columns){
        return $columns;
    }
    
    /*
     * Edit Columns HTML
     */
    function edit_columns_html($column, $post_id){
        // ...
    }
    
    /*
     * Display Post States
     */
    function display_post_states($post_states, $post){
        
        if($post->post_status === 'acf-disabled'){
            $post_states['acf-disabled'] = '<span class="dashicons dashicons-hidden acf-js-tooltip" title="' . _x('Disabled', 'post status', 'acf') . '"></span>';
        }
        
        return $post_states;
        
    }
    
    /*
     * Edit Row Actions
     */
    function _edit_row_actions($actions, $post){
    
        if(!in_array($post->post_status, array('publish', 'acf-disabled'))){
            return $actions;
        }
    
        $post_id = $post->ID;
        $name = $this->get_name($post_id);
        
        acfe_unset($actions, 'inline hide-if-no-js');
        
        // View
        $view = $this->edit_row_actions_view($post, $name);
        
        if($view){
            $actions['view'] = $view;
        }
        
        // Tools
        foreach($this->tools as $action){
            
            $action_name = $action === 'php' ? 'PHP' : 'Json';
            $actions[$action] = '<a href="' . admin_url("edit.php?post_type=acf-field-group&page=acf-tools&tool={$this->tool}&action={$action}&keys={$name}") . '">' . $action_name . '</a>';
            
        }
        
        return $this->edit_row_actions($actions, $post);
        
    }
    
    function edit_row_actions($actions, $post){
        return $actions;
    }
    
    function edit_row_actions_view($post, $name){
        return false;
    }
    
    /*
     * Edit Foot
     */
    function edit_footer(){
        // ...
    }
    
    /*
     * ACF Save post
     */
    function _save_post($post_id){
    
        if(!is_numeric($post_id) || get_post_type($post_id) !== $this->post_type){
            return;
        }
        
        $this->save_post($post_id);
        
    }
    
    function save_post($post_id){
        // ...
    }
    
    /*
     * Trashed Post Type
     */
    function _trashed_post($post_id){
        
        if(get_post_type($post_id) !== $this->post_type){
            return;
        }
    
        $this->trashed_post($post_id);
        
    }
    
    function trashed_post($post_id){
        // ...
    }
    
    /*
     * Untrashed Post Type
     */
    function _untrashed_post($post_id){
        
        if(get_post_type($post_id) !== $this->post_type){
            return;
        }
        
        $this->_save_post($post_id);
        $this->untrashed_post($post_id);
        
    }
    
    function untrashed_post($post_id){
        // ...
    }
    
    /*
     * Import
     */
    function import($name, $args){
        // ...
    }
    
    /*
     * Export
     */
    function export_choices(){
        return array();
    }
    
    function export_data($name){
        // ...
    }
    
    function export_php($data){
        return false;
    }
    
    /*
     * Reset
     */
    function reset(){
        // ...
    }
    
    /*
     * Exclude Post Type
     */
    function get_post_types($post_types, $args){
        
        foreach($post_types as $k => $post_type){
            
            if($post_type !== $this->post_type) continue;
            
            unset($post_types[$k]);
            
        }
        
        return $post_types;
        
    }
    
    /*
     * Get Field Labels Recursive
     */
    function get_fields_labels_recursive(&$array, $field){
        
        $label = '';
        
        $ancestors = isset($field['ancestors']) ? $field['ancestors'] : count(acf_get_field_ancestors($field));
        $label = str_repeat('- ', $ancestors) . $label;
        
        $label .= !empty($field['label']) ? $field['label'] : '(' . __('no label', 'acf') . ')';
        $label .= $field['required'] ? ' <span class="acf-required">*</span>' : '';
        
        $array[$field['key']] = $label;
        
        if(isset($field['sub_fields']) && !empty($field['sub_fields'])){
            
            foreach($field['sub_fields'] as $s_field){
                
                $this->get_fields_labels_recursive($array, $s_field);
                
            }
            
        }
        
    }
    
    /*
     * Add Local Field Group
     */
    function add_local_field_group(){
        // ...
    }
    
}