PHPackages                             getolympus/olympus-dionysos-field-code - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. getolympus/olympus-dionysos-field-code

ActiveOlympus-field[Framework](/categories/framework)

getolympus/olympus-dionysos-field-code
======================================

Code field, this component is a part of the Olympus Dionysos fields.

v0.0.14(2y ago)02172MITPHPCI failing

Since Apr 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/GetOlympus/olympus-dionysos-field-code)[ Packagist](https://packagist.org/packages/getolympus/olympus-dionysos-field-code)[ Docs](https://github.com/GetOlympus/olympus-dionysos-field-code)[ RSS](/packages/getolympus-olympus-dionysos-field-code/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (15)Used By (2)

[![](https://github.com/GetOlympus/olympus-dionysos-field-code/raw/master/assets/field-code.png)](https://github.com/GetOlympus/olympus-dionysos-field-code/blob/master/assets/field-code.png)

Dionysos Code Field
===================

[](#dionysos-code-field)

[![Olympus Component](https://camo.githubusercontent.com/f483886a465a9e44005a352c6c1ba6556689a579ecf0d8b984cf60becaaa878c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666f722d4f6c796d7075732d3434636331312e7376673f7374796c653d666c61742d737175617265)](https://github.com/GetOlympus)[![CodeFactor Grade](https://camo.githubusercontent.com/da8f5d14c6e96e4f61f28beb35e8a498f4d58a63a9f7d947ffd3d00124d10baf/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f4765744f6c796d7075732f6f6c796d7075732d64696f6e79736f732d6669656c642d636f64652f62616467653f7374796c653d666c61742d737175617265)](https://www.codefactor.io/repository/github/getolympus/olympus-dionysos-field-code)[![Packagist Version](https://camo.githubusercontent.com/961901d6ec8cce512cf1d4acbf2e06b93b29de3919333fa692812480d56fefd6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765746f6c796d7075732f6f6c796d7075732d64696f6e79736f732d6669656c642d636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/getolympus/olympus-dionysos-field-code)[![MIT](https://camo.githubusercontent.com/68035de4b7f69ada20e98e34172f47d361b83a017c8045200fc338660c467897/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49545f4c6963656e73652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/GetOlympus/olympus-dionysos-field-code/blob/master/LICENSE)

> This component is a part of the **Olympus Dionysos fields** for **WordPress**.
> It uses the default WordPress code field made with a complete integration with codemirror JS component.

```
composer require getolympus/olympus-dionysos-field-code
```

---

Table of contents
-----------------

[](#table-of-contents)

[Field initialization](#field-initialization) • [Variables definition](#variables-definition) • [Accepted mode](#accepted-mode) • [Retrive data](#retrive-data) • [Release History](#release-history) • [Contributing](#contributing)

---

Field initialization
--------------------

[](#field-initialization)

Use the following lines to add a `code field` in your **WordPress** admin pages or custom post type meta fields:

```
return \GetOlympus\Dionysos\Field\Code::build('my_code_field_id', [
    'title'       => 'How do Penguins code their icebergs?',
    'default'     => 'With a frozen bug.',
    'description' => 'A simple question to let you know how to seduce a penguin.',
    'mode'        => 'json',
    'rows'        => 4,

    /**
     * Code mirror settings
     * @see https://developer.wordpress.org/reference/functions/wp_get_code_editor_settings/
     */
    'settings' => [
        'indentUnit'     => 2,
        'indentWithTabs' => false,
        'tabSize'        => 2,
    ],
]);
```

Variables definition
--------------------

[](#variables-definition)

VariableTypeDefault value if not setAccepted values`title`String`'Code'`*empty*`default`String*empty**empty*`description`String*empty**empty*`mode`String`text/html`see [Accepted mode](#accepted-mode)`rows`Integer`4``> 1``settings`Arraysee [Field initialization](#field-initialization)see [WordPress reference](https://developer.wordpress.org/reference/functions/wp_get_code_editor_settings/)Accepted mode
-------------

[](#accepted-mode)

- `text/css` or `css`
- `text/x-diff` or `x-diff` or `diff`
- `text/html` or `html`
- `text/javascript` or `javascript` or `js`
- `application/json` or `json`
- `text/x-markdown` or `markdown` or `md`
- `application/x-httpd-php` or `x-httpd-php` or `php`
- `text/x-python` or `x-python` or `python`
- `text/x-ruby` or `x-ruby` or `ruby`
- `text/x-sh` or `x-sh` or `sh`
- `text/x-mysql` or `x-mysql` or `mysql`
- `text/x-mariadb` or `x-mariadb` or `mariadb`
- `application/xml` or `xml`
- `text/x-yaml` or `x-yaml` or `yaml`

Usage example
-------------

[](#usage-example)

Fill the form properly (with JSON in this example):

```
{
    "response": "With a frozen bug."
}
```

Retrive data
------------

[](#retrive-data)

Retrieve your value from Database with a simple `get_option('my_code_field_id', '')` (see [WordPress reference](https://developer.wordpress.org/reference/functions/get_option/)):

```
// Get code from Database
$code = get_option('my_code_field_id', '');

// Display code in HTML tag
echo ''.htmlspecialchars($code).'';
```

Release history
---------------

[](#release-history)

VersionNote0.0.14Fix jQuery integration on domReady0.0.13Add new CodeMirror css for widget integration0.0.12New Olympus components compatibility
Change repository to be a part of Dionysos fieldsContributing
------------

[](#contributing)

1. Fork it ()
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request

---

**Built with ♥ by [Achraf Chouk](https://github.com/crewstyle "Achraf Chouk") ~ (c) since a long time.**

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~232 days

Recently: every ~405 days

Total

13

Last Release

871d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c255b14ebf8b792ba8b0c9940bd13e899281fc1431f1088af9074acdaa191cef?d=identicon)[crewstyle](/maintainers/crewstyle)

---

Top Contributors

[![crewstyle](https://avatars.githubusercontent.com/u/1572149?v=4)](https://github.com/crewstyle "crewstyle (42 commits)")

---

Tags

codecodemirrorcustomfieldframeworkolympus-zeusphptwigwordpressphpframeworkwordpresscodefieldcodemirrorcustomolympusdionysos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/getolympus-olympus-dionysos-field-code/health.svg)

```
[![Health](https://phpackages.com/badges/getolympus-olympus-dionysos-field-code/health.svg)](https://phpackages.com/packages/getolympus-olympus-dionysos-field-code)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
