{"id":18293199,"url":"https://github.com/getolympus/olympus-dionysos-field-code","last_synced_at":"2026-05-01T19:34:38.258Z","repository":{"id":62510295,"uuid":"57338933","full_name":"GetOlympus/olympus-dionysos-field-code","owner":"GetOlympus","description":"Διώνυσος — Code field, this component is a part of the Olympus Dionysos fields for WordPress.","archived":false,"fork":false,"pushed_at":"2023-12-20T22:11:54.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T02:05:28.136Z","etag":null,"topics":["code","codemirror","custom","field","framework","olympus-zeus","php","twig","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GetOlympus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-28T22:57:08.000Z","updated_at":"2024-08-05T17:43:51.552Z","dependencies_parsed_at":"2024-08-05T17:43:50.927Z","dependency_job_id":"fc480e33-ea89-4d1a-a706-5aa4afb1ad13","html_url":"https://github.com/GetOlympus/olympus-dionysos-field-code","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetOlympus%2Folympus-dionysos-field-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetOlympus%2Folympus-dionysos-field-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetOlympus%2Folympus-dionysos-field-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GetOlympus%2Folympus-dionysos-field-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GetOlympus","download_url":"https://codeload.github.com/GetOlympus/olympus-dionysos-field-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999864,"owners_count":21031046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","codemirror","custom","field","framework","olympus-zeus","php","twig","wordpress"],"created_at":"2024-11-05T14:23:11.156Z","updated_at":"2026-05-01T19:34:38.219Z","avatar_url":"https://github.com/GetOlympus.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/GetOlympus/olympus-dionysos-field-code/blob/master/assets/field-code.png\" align=\"left\" /\u003e\n\n# Dionysos Code Field\n\n[![Olympus Component][olympus-image]][olympus-url]\n[![CodeFactor Grade][codefactor-image]][codefactor-url]\n[![Packagist Version][packagist-image]][packagist-url]\n[![MIT][license-image]][license-blob]\n\n\u003e This component is a part of the **Olympus Dionysos fields** for **WordPress**.  \n\u003e It uses the default WordPress code field made with a complete integration with codemirror JS component.\n\n```sh\ncomposer require getolympus/olympus-dionysos-field-code\n```\n\n---\n\n## Table of contents\n\n[Field initialization](#field-initialization) • [Variables definition](#variables-definition) • [Accepted mode](#accepted-mode) • [Retrive data](#retrive-data) • [Release History](#release-history) • [Contributing](#contributing)\n\n---\n\n## Field initialization\n\nUse the following lines to add a `code field` in your **WordPress** admin pages or custom post type meta fields:\n\n```php\nreturn \\GetOlympus\\Dionysos\\Field\\Code::build('my_code_field_id', [\n    'title'       =\u003e 'How do Penguins code their icebergs?',\n    'default'     =\u003e 'With a frozen bug.',\n    'description' =\u003e 'A simple question to let you know how to seduce a penguin.',\n    'mode'        =\u003e 'json',\n    'rows'        =\u003e 4,\n\n    /**\n     * Code mirror settings\n     * @see https://developer.wordpress.org/reference/functions/wp_get_code_editor_settings/\n     */\n    'settings' =\u003e [\n        'indentUnit'     =\u003e 2,\n        'indentWithTabs' =\u003e false,\n        'tabSize'        =\u003e 2,\n    ],\n]);\n```\n\n## Variables definition\n\n| Variable      | Type    | Default value if not set | Accepted values |\n| ------------- | ------- | ------------------------ | --------------- |\n| `title`       | String  | `'Code'` | *empty* |\n| `default`     | String  | *empty* | *empty* |\n| `description` | String  | *empty* | *empty* |\n| `mode`        | String  | `text/html` | see [Accepted mode](#accepted-mode) |\n| `rows`        | Integer | `4` | `\u003e 1` |\n| `settings`    | Array   | see [Field initialization](#field-initialization) | see [WordPress reference](https://developer.wordpress.org/reference/functions/wp_get_code_editor_settings/) |\n\n## Accepted mode\n\n* `text/css` or `css`\n* `text/x-diff` or `x-diff` or `diff`\n* `text/html` or `html`\n* `text/javascript` or `javascript` or `js`\n* `application/json` or `json`\n* `text/x-markdown` or `markdown` or `md`\n* `application/x-httpd-php` or `x-httpd-php` or `php`\n* `text/x-python` or `x-python` or `python`\n* `text/x-ruby` or `x-ruby` or `ruby`\n* `text/x-sh` or `x-sh` or `sh`\n* `text/x-mysql` or `x-mysql` or `mysql`\n* `text/x-mariadb` or `x-mariadb` or `mariadb`\n* `application/xml` or `xml`\n* `text/x-yaml` or `x-yaml` or `yaml`\n\n## Usage example\n\nFill the form properly (with JSON in this example):\n\n```json\n{\n    \"response\": \"With a frozen bug.\"\n}\n```\n\n## Retrive data\n\nRetrieve your value from Database with a simple `get_option('my_code_field_id', '')` (see [WordPress reference][getoption-url]):\n\n```php\n// Get code from Database\n$code = get_option('my_code_field_id', '');\n\n// Display code in HTML tag\necho '\u003cpre\u003e'.htmlspecialchars($code).'\u003c/pre\u003e';\n```\n\n## Release history\n\n| Version | Note |\n| :------ | :--- |\n| 0.0.14  | Fix jQuery integration on domReady |\n| 0.0.13  | Add new CodeMirror css for widget integration |\n| 0.0.12  | New Olympus components compatibility\u003cbr/\u003eChange repository to be a part of Dionysos fields |\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/GetOlympus/olympus-dionysos-field-code/fork\u003e)\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n\n---\n\n**Built with ♥ by [Achraf Chouk](https://github.com/crewstyle \"Achraf Chouk\") ~ (c) since a long time.**\n\n\u003c!-- links \u0026 imgs dfn's --\u003e\n[olympus-image]: https://img.shields.io/badge/for-Olympus-44cc11.svg?style=flat-square\n[olympus-url]: https://github.com/GetOlympus\n[codefactor-image]: https://www.codefactor.io/repository/github/GetOlympus/olympus-dionysos-field-code/badge?style=flat-square\n[codefactor-url]: https://www.codefactor.io/repository/github/getolympus/olympus-dionysos-field-code\n[getoption-url]: https://developer.wordpress.org/reference/functions/get_option/\n[license-blob]: https://github.com/GetOlympus/olympus-dionysos-field-code/blob/master/LICENSE\n[license-image]: https://img.shields.io/badge/license-MIT_License-blue.svg?style=flat-square\n[packagist-image]: https://img.shields.io/packagist/v/getolympus/olympus-dionysos-field-code.svg?style=flat-square\n[packagist-url]: https://packagist.org/packages/getolympus/olympus-dionysos-field-code","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetolympus%2Folympus-dionysos-field-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetolympus%2Folympus-dionysos-field-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetolympus%2Folympus-dionysos-field-code/lists"}