<?php
/**
 * Class for building the custom heading
 * custom fields in the post edit page
 *
 * @author jason.xie@victheme.com
 *
 */
class VTCore_Wordpress_Metabox_CustomHeader
extends VTCore_Wordpress_Models_Metabox {

  protected $nonce_id = '_vtcore_wordpress_custom_heading_nonce';
  protected $nonce_key = '_vtwocusthe_nonce';
  protected $meta_id = 'vtcore_wordpress_custom_heading';
  protected $meta_key = 'vtcore_wordpress_custom_heading';

  /**
   * Building the metabox form
   */
  public function buildForm() {

    VTCore_Wordpress_Utility::loadAsset('wp-bootstrap');

    $this->form = new VTCore_Bootstrap_Form_BsInstance(array(
      'type' => '',
      'attributes' => false,
    ));

    $this->form
      ->addOverloaderPrefix('VTCore_Wordpress_Form_')
      ->WpNonce(array(
        'action' => $this->nonce_key,
        'attributes' => array(
          'type' => 'hidden',
          'name' => $this->nonce_id,
          'value' => '',
        ),
      ))
      ->wpMedia(array(
        'name' => $this->meta_key . '[image]',
        'text' => __('Heading Image', VTCORE_LANGUAGE),
        'value' => $this->get('image'),
        'data' => array(
          'type' => 'image',
          'title' => __('Select File', VTCORE_LANGUAGE),
          'button' =>__('Select Image', VTCORE_LANGUAGE),
        ),
      ))
      ->BsText(array(
        'text' => __('Heading', VTCORE_LANGUAGE),
        'name' => $this->meta_key . '[header]',
        'value' => $this->get('header'),
      ))
      ->BsTextarea(array(
        'text' => __('Description', VTCORE_LANGUAGE),
        'name' => $this->meta_key . '[description]',
        'value' => $this->get('description'),
      ));
  }


}