PHP code example of wpfulcrum / config

1. Go to this page and download the library: Download wpfulcrum/config library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wpfulcrum / config example snippets




return [
	'autoload'  => true,
	'classname' => 'YourBrand\YourProject\Shortcode\QA',
	'config'    => [
		'shortcode' => 'qa',
		'view'      => YOURPLUGIN_PATH . 'src/Shortcode/views/qa.php',
		'defaults'  => [
			'id'         => '',
			'class'      => '',
			'question'   => '',
			'type'       => '',
			'color'      => '',
			'open_icon'  => 'fa fa-chevron-down',
			'close_icon' => 'fa fa-chevron-up',
		],
	],
];




namespace YourBrand\YourProject\Shortcode;

use Fulcrum\Config\ConfigContract;
use Fulcrum\Custom\Shortcode\Shortcode;

class QA extends Shortcode
{
    /**
     * Runtime configuration parameters.
     * 
     * @var ConfigContract
     */
    protected $config;

    /**
     * QA constructor.
     *
     * @param ConfigContract $config Instance of the runtime configuration parameters for this QA shortcode.
     */
    public function __construct(ConfigContract $config)
    {
        $this->config = $config;
    }
    
    /**
     * Build the Shortcode HTML and then return it.
     *
     * @since 1.0.0
     *
     * @return string Shortcode HTML
     */
    protected function render() {
        $content = do_shortcode( $this->content );

        ob_start();
        

$qaShortcode = new QA(
    ConfigFactory::create(YOURPLUGIN_PATH . '/config/shortcode/qa.php')  
);

$qaShortcode = new QA(
    ConfigFactory::create(
        YOURPLUGIN_PATH . '/config/shortcode/qa.php',
        YOURPLUGIN_PATH . '/config/shortcode/defaults.php
    )  
);