CoreFramework\Helper

Introduction

The Helper class provided in the plugin is a powerful tool designed to facilitate easy access to a list of variables and classes within the Core Framework. This class allows developers to retrieve variables and classes, making it convenient to implement Core Framework into various Wordpress plugins.

Usage

use CoreFramework\Helper;

if (is_plugin_active('core-framework/core-framework.php')) {
    if (class_exists('CoreFramework\Helper')) {
        $helper = new Helper(); 

        $class_names = $helper->getClassNames(); // [ 'colorStyles' => ['bg-primary', 'text-primary', 'border-primary'], 'typographyStyles' => [...], 'spacingStyles' => [...], 'layoutsStyles' => [...], 'designStyles' => [...], 'componentsStyles' => [...], 'otherStyles' => [...] ];
        $class_names = $helper->getClassNames([
            'group_by_category' => false,
        ]); // ['bg-primary', 'text-primary', 'border-primary', ...]

        $variables = $helper->getVariables(); // [ 'colorStyles' => ['primary', 'secondary'], 'typographyStyles' => [...], 'spacingStyles' => [...], 'layoutsStyles' => [...], 'designStyles' => [...], 'componentsStyles' => [...], 'otherStyles' => [...] ];
        $variables = $helper->getVariables([
            'group_by_category' => false,
        ]); // ['primary', 'secondary', ...]
    }
}

Method: $helper->getStylesheetUrl()

Since: 1.3.3

Retrieves the full URL of the core framework stylesheet.

Method: $helper->getStylesheetPath()

Since: 1.3.3

Obtains the server path to the core framework stylesheet.

Method: $helper->getStylesheetVersion()

Since: 1.3.3

Fetches the version of the core framework stylesheet.

Method: $helper->getClassNames([options])

Parameters:

  • options (optional, array): An array of options to customise the output. The options array may contain the following keys

    Option
    Type
    Default
    Description

    group_by_category

    boolean

    true

    Determines whether the returned data should be grouped by category.

    excluded_keys

    string[]

    []

    An array of keys that should be excluded from the returned data. For example, to exclude all class names or variables related to colors, pass ['colorStyles'] as an element of the excluded_keys array. The keys can be any of the following predefined strings: 'colorStyles', 'typographyStyles', 'spacingStyles', 'layoutsStyles', 'designStyles', 'componentsStyles', 'otherStyles'.

Method: $helper->getVariables([options])

Parameters:

  • options (optional, array): An array of options to customise the output. The options array may contain the following keys

    Option
    Type
    Default
    Description

    group_by_category

    boolean

    true

    Determines whether the returned data should be grouped by category.

    excluded_keys

    string[]

    []

    An array of keys that should be excluded from the returned data. For example, to exclude all class names or variables related to colors, pass ['colorStyles'] as an element of the excluded_keys array. The keys can be any of the following predefined strings: 'colorStyles', 'typographyStyles', 'spacingStyles', 'layoutsStyles', 'designStyles', 'componentsStyles', 'otherStyles'.

Helper class has been introduced in version 1.2.7.

Last updated