2017 © Pedro Peláez
 

olympus-field olympus-file-field

[READ-ONLY] File field, this component is a part of the Olympus Zeus Core framework.

image

getolympus/olympus-file-field

[READ-ONLY] File field, this component is a part of the Olympus Zeus Core framework.

  • Saturday, March 17, 2018
  • by crewstyle
  • Repository
  • 1 Watchers
  • 0 Stars
  • 150 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Dionysos Content Field

This component is a part of the Olympus Dionysos fields for WordPress., (*1)

composer require getolympus/olympus-dionysos-field-content

Olympus Component ![CodeFactor Grade][codefactor-image] Packagist Version ![MIT][license-image], (*2)


, (*3)


Field initialization

Use the following lines to add a content field in your WordPress admin pages or custom post type's meta fields:
Note the $identifier (first ::build() parameter) is set to false because no value is stored in database., (*4)

return \GetOlympus\Dionysos\Field\Content::build(false, [
    'title'   => 'The Dark Knight',
    'content' => '',
    'debug'   => false,
    'file'    => 'im_the_batman.php',
    'vars'    => [
        'question' => 'Who\'s the Batman?',
        'answers'  => [
            'the-joker'    => 'The Joker',
            'harley-quinn' => 'Harley Quinn',
            'bruce-wayne'  => 'Bruce Wayne, don\'t tell anybody!',
            'gotham-city'  => 'Gotham City',
        ],
    ],
]);

Variables definitions

Variable Type Default value if not set Accepted values
title String 'File contents' empty
content String empty empty
debug Bookean empty empty
file String false true or false
vars Array empty empty

Notes: * Set content to display HTML tags. It can be used as a fallback if file doesn't exist * Set debug to true to enable the debug mode in case file inclusion fail * Set file to define the PHP file path to include as include_once PHP function, (*5)

Vars usage

In the included file (im_the_batman.php in this example), you can use the $v variable as an array:, (*6)

// Display question
echo '

'.stripslashes($v['question']).'

'; echo '
    '; // Display answers choices with radio button foreach ($v['answers'] as $k => $answer) { echo '
  • '.stripslashes($answer).'
  • '; } echo '
';

Content display priority

The component will display, by priority:, (*7)

  1. included file path
  2. everything in content

Note: do not forget to set debug to true to display an error in the case the file does not exist or is not readable., (*8)

Release History

0.0.12 - Remove useless description, (*9)

0.0.11 - New Olympus components compatibility - Change repository to be a part of Dionysos fields, (*10)

0.0.10 - FIX: content raw display on twig file, (*11)

Contributing

  1. Fork it (https://github.com/GetOlympus/olympus-dionysos-field-content/fork)
  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 ~ (c) since a long time., (*12)

The Versions

17/03 2018

dev-master

9999999-dev https://github.com/GetOlympus/olympus-file-field

[READ-ONLY] File field, this component is a part of the Olympus Zeus Core framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

file framework php field olympus zeus hera

17/03 2018

v0.0.5

0.0.5.0 https://github.com/GetOlympus/olympus-file-field

[READ-ONLY] File field, this component is a part of the Olympus Zeus Core framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

file framework php field olympus zeus

26/06 2016

v0.0.4

0.0.4.0 https://github.com/GetOlympus/olympus-file-field

[READ-ONLY] File field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

file framework php field olympus hera

08/05 2016

v0.0.3

0.0.3.0 https://github.com/GetOlympus/olympus-file-field

[READ-ONLY] File field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

file framework php field olympus hera

05/05 2016

v0.0.2

0.0.2.0 https://github.com/GetOlympus/olympus-include-field

[READ-ONLY] Include field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

framework php field include olympus hera

29/04 2016

v0.0.1

0.0.1.0 https://github.com/GetOlympus/olympus-include-field

[READ-ONLY] Include field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

framework php field include olympus hera