<?php

namespace auctionforge\inc\controllers;

use auctionforge\inc\helpers\View;
use WP_Post;

class MetaBoxImages
{
    const SEO_METABOX_NONCE = 'seo_metabox_nonce';

    public function init()
    {
        add_action('admin_menu', array($this, 'lotimgs_meta_boxes'));
    }

    public function lotimgs_meta_boxes() {
        add_meta_box('lotimgsdiv', __('Lot Images'), array($this, 'lot_img_print_box'), 'lot', 'side', 'default');
    }

    /**
     * @param $post WP_Post
     */
    public function lot_img_print_box($post) {
        wp_nonce_field(basename( __FILE__ ), self::SEO_METABOX_NONCE);

        $images = get_attached_media('image', $post->ID);
        echo View::render('admin.view.meta_box_images', array(
            'images' => $images
        ));
    }
}
$metaBoxImages = new MetaBoxImages();
$metaBoxImages->init();
