public function addPageSummaryMetaBox($postType, $post)
    {
        $allowedPostTypes = get_field('customer_feedback_posttypes', 'option');

        if (!isset($post->ID) || (is_array($allowedPostTypes) && !in_array($postType, $allowedPostTypes))) {
            return;
        }

        $answers = Responses::getResponses($post->ID);

        if (count($answers) === 0) {
            return;
        }

        add_meta_box(
            'customer-feedback-summary-meta',
            __('Customer feedback summary', 'customer-feedback') . ' (' . __('since', 'customer-feedback') . ' ' . get_the_modified_date('Y-m-d H:i') . ')',
            array($this, 'renderSummary'),
            $postType,
            'side',
            'default',
            array(
                'results' => $answers
            )
        );
    }
public function addPageSummaryMetaBox($postType, $post)
    {
        $allowedPostTypes = get_field('customer_feedback_posttypes', 'option');

        if (!isset($post->ID) || (is_array($allowedPostTypes) && !in_array($postType, $allowedPostTypes))) {
            return;
        }

        $answers = Responses::getResponses($post->ID);

        if (count($answers) === 0) {
            return;
        }

        add_meta_box(
            'customer-feedback-summary-meta',
            __('Customer feedback summary', 'customer-feedback') . ' (' . __('since', 'customer-feedback') . ' ' . get_the_modified_date('Y-m-d H:i') . ')',
            array($this, 'renderSummary'),
            $postType,
            'side',
            'default',
            array(
                'results' => $answers
            )
        );
    }
public function addPageSummaryMetaBox ( $ postType , $ post ) { $ allowedPostTypes = get_field ( 'customer_feedback_posttypes' , 'option' ) ; if ( ! isset ( $ post -> ID ) || ( is_array ( $ allowedPostTypes ) && ! in_array ( $ postType , $ allowedPostTypes ) ) ) { return ; } $ answers = Responses :: getResponses ( $ post -> ID ) ; if ( count ( $ answers ) === 0 ) { return ; } add_meta_box ( 'customer-feedback-summary-meta' , __ ( 'Customer feedback summary' , 'customer-feedback' ) . ' (' . __ ( 'since' , 'customer-feedback' ) . ' ' . get_the_modified_date ( 'Y-m-d H:i' ) . ')' , array ( $ this , 'renderSummary' ) , $ postType , 'side' , 'default' , array ( 'results' => $ answers ) ) ; }
Display summary metabox
@param string $postType Post type
@param object $post     Current post
Display summary metabox