<?php

namespace AdvancedBlockControls;

// Exit if the file is accessed directly
if ( !defined('ABSPATH') ) {
    exit; 
}

class AttributesManager
{
    const ATTRIBUTE_KEY = "abcon_controls_data"; 

    public function __construct()
    {
        add_filter('register_block_type_args', [$this, 'register'], 500, 2);
    }

    public function register($args, $block_type)
    {
        
        if (is_array($args)) {
            $args['attributes'][self::ATTRIBUTE_KEY] = array(
                'type' => 'string',
                'default' => "{}"
            );
        }

        return $args;
    }
}
