# 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

{% code fullWidth="false" %}

```php
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', ...]
    }
}
```

{% endcode %}

### 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

  <table><thead><tr><th width="227">Option</th><th width="107">Type</th><th width="91">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>group_by_category</code></td><td>boolean</td><td><code>true</code></td><td>Determines whether the returned data should be grouped by category.</td></tr><tr><td><code>excluded_keys</code></td><td>string[] </td><td><code>[]</code></td><td>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 <code>['colorStyles']</code> as an element of the <code>excluded_keys</code> array. The keys can be any of the following predefined strings: 'colorStyles', 'typographyStyles', 'spacingStyles', 'layoutsStyles', 'designStyles', 'componentsStyles', 'otherStyles'.</td></tr></tbody></table>

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

**Parameters:**

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

  <table><thead><tr><th width="227">Option</th><th width="107">Type</th><th width="91">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>group_by_category</code></td><td>boolean</td><td><code>true</code></td><td>Determines whether the returned data should be grouped by category.</td></tr><tr><td><code>excluded_keys</code></td><td>string[] </td><td><code>[]</code></td><td>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 <code>['colorStyles']</code> as an element of the <code>excluded_keys</code> array. The keys can be any of the following predefined strings: 'colorStyles', 'typographyStyles', 'spacingStyles', 'layoutsStyles', 'designStyles', 'componentsStyles', 'otherStyles'.</td></tr></tbody></table>

Helper class has been introduced in version 1.2.7.
