<?php
|
|
|
|
use WordPlate\Acf\Fields\ColorPicker;
|
|
use WordPlate\Acf\Fields\File;
|
|
use WordPlate\Acf\Fields\Image;
|
|
use WordPlate\Acf\Location;
|
|
|
|
/**
|
|
* The admin-specific functionality of the plugin.
|
|
*
|
|
* @link https://horizontes.info
|
|
* @since 1.0.0
|
|
*
|
|
* @package Reuna_Blocos
|
|
* @subpackage Reuna_Blocos/admin
|
|
*/
|
|
|
|
/**
|
|
* The admin-specific functionality of the plugin.
|
|
*
|
|
* Defines the plugin name, version, and two examples hooks for how to
|
|
* enqueue the admin-specific stylesheet and JavaScript.
|
|
*
|
|
* @package Reuna_Blocos
|
|
* @subpackage Reuna_Blocos/admin
|
|
* @author Horizontes Coop. <contato@horizontes.info>
|
|
*/
|
|
class Reuna_Blocos_Admin {
|
|
|
|
/**
|
|
* The ID of this plugin.
|
|
*
|
|
* @since 1.0.0
|
|
* @access private
|
|
* @var string $plugin_name The ID of this plugin.
|
|
*/
|
|
private $plugin_name;
|
|
|
|
/**
|
|
* The version of this plugin.
|
|
*
|
|
* @since 1.0.0
|
|
* @access private
|
|
* @var string $version The current version of this plugin.
|
|
*/
|
|
private $version;
|
|
|
|
/**
|
|
* Initialize the class and set its properties.
|
|
*
|
|
* @since 1.0.0
|
|
* @param string $plugin_name The name of this plugin.
|
|
* @param string $version The version of this plugin.
|
|
*/
|
|
public function __construct( $plugin_name, $version )
|
|
{
|
|
$this->plugin_name = $plugin_name;
|
|
$this->version = $version;
|
|
}
|
|
|
|
/**
|
|
* Register the stylesheets for the admin area.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function enqueue_styles()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Register the JavaScript for the admin area.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function enqueue_scripts()
|
|
{
|
|
}
|
|
|
|
public function register_material_block()
|
|
{
|
|
acf_register_block([
|
|
'name' => 'material',
|
|
'title' => __('Material', 'reuna-blocos'),
|
|
'description' => __('Material para download', 'reuna-blocos'),
|
|
'category' => 'common',
|
|
'icon' => 'media-default',
|
|
'keywords' => ['material', 'reuna'],
|
|
'render_template' => plugin_dir_path( __FILE__ ) . 'views/material.php',
|
|
'enqueue_style' => plugin_dir_url( __FILE__ ) . 'dist/css/blocos.css'
|
|
]);
|
|
}
|
|
|
|
public function register_material_fields()
|
|
{
|
|
register_extended_field_group([
|
|
'title' => 'Material',
|
|
|
|
'fields' => [
|
|
Image::make('Capa')->returnFormat('id'),
|
|
File::make('Arquivo (online)'),
|
|
File::make('Arquivo (impressão)'),
|
|
ColorPicker::make('Cor')->defaultValue('#F15A31'),
|
|
],
|
|
|
|
'location' => [
|
|
Location::if('block', 'acf/material'),
|
|
],
|
|
]);
|
|
}
|
|
}
|