# Extending Uni CPO

### Adding new options

New option must be a class that follow specific naming convention and extends abstract 'Uni\_Cpo\_Option' class and implements the same interface as other option related classes. The easiest solution would be to make a copy of one of the existing classes and modify it according to your needs.

The naming convention examples:

* if option type is 'fantasy\_option' then its class must be called 'Uni\_Cpo\_Option\_Fantasy\_Option'
* if option type is 'radio\_special\_links' then its class must be called 'Uni\_Cpo\_Option\_Radio\_Special\_Links'

#### Filters

```
uni_cpo_option_types
```

This filter accepts one argument - an array of unique option names.

Example of using:

```php
add_filter( 'uni_cpo_option_types', 'my_option_types', 10, 1 )
function my_option_types($types) {
        $types[] = 'fantasy_option';
        return $types;
}
```

\------------------------

```
uni_cpo_option_classes / uni_cpo_option_classes_pro
```

This filter accepts one argument - an array of paths to php file with class of the option. The filter prefixed with 'pro' will be used only in PRO version of the plugin.

Example of using:

```php
add_filter( 'uni_cpo_option_classes', 'my_option_classes', 10, 1 )
function my_option_classes($pathes) {
        $pathes[] = $this->plugin_path() . '/inc/class-uni-cpo-option-fantasy-option.php';
        return $pathes;
}
```

### Adding new settings

Similar to new option class name, setting class name follows the same naming convention and extends one of the abstract classes. The easiest way would be to make a copy of existing setting class and then modify it.

#### Filters

```
uni_cpo_setting_types
```

This filter accepts one argument - an array of unique setting names.

Example of using:

```php
add_filter( 'uni_cpo_setting_types', 'my_settings_types', 10, 1 )
function my_settings_types($types) {
        $types[] = 'super_setting';
        return $types;
}
```

\------------------------

```
uni_cpo_settings_classes / uni_cpo_settings_classes_pro
```

This filter accepts one argument - an array of paths to php file with class of the setting. The filter prefixed with 'pro' will be used only in PRO version of the plugin.

Example of using:

```php
add_filter( 'uni_cpo_settings_classes', 'my_settings_classes', 10, 1 )
function my_settings_classes($pathes) {
        $pathes[] = $this->plugin_path() . '/inc/class-uni-cpo-setting-super-setting.php';
        return $pathes;
}
```

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.moomoo.agency/uni-cpo-4-documentation/for-developers/extending-uni-cpo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
