Standard C5 Inputs

Permalink 3 users found helpful
So I'm creating a Block that goes a bit beyond some of the original features of the bundled "content" Block. As I'm using this to learn as well, I've noticed that there's a lot of tinymce initialization code found in editor_config.php. Much of it focusing around making C5 features and visual appearances available.

Now I suppose it's simple enough for me to copy/paste this and adapt it. But I was wondering if there is or are any plans to develop a standard C5 widget library for the back-end interfaces. Main reason being is that I don't like the idea of maintaining multiple separate tinyMCE configurations, when really all I want is one provided to me as a part of C5.

Any thoughts or tips? Or has this been considered already?

 
Mnkras replied on at Permalink Reply
Mnkras
its really up to the developer, there is a central place, its in the /elements folder (or /concrete/elements), you can find that file and a few others that any block or singlepage or tool can call, using Loader::Element('name_of_file_without.php');
C5Omega replied on at Permalink Reply
So, how do I make use of the editor element? If I include it, will it obtain it's configuration, or is it much the same as how it's used by the default content area?

Are there any specific guides on how to use C5's library of elements?
Mnkras replied on at Permalink Reply
Mnkras
here is how the edit.php and add.php would look if it used the elements in the core.

<?php
Loader::element('editor_init');
Loader::element('editor_config');
Loader::element('editor_controls');
?>
<div style="text-align: center" id="ccm-editor-pane">
<textarea id="ccm-content-<?=$b->getBlockID()?>-<?=$a->getAreaID()?>" class="advancedEditor ccm-advanced-editor" name="content"><?=$controller->getContentEditMode()?></textarea>
</div>
TheRealSean replied on at Permalink Reply
TheRealSean
This is very helpful, thanks very much.

I recently had to add tinyMCE into a block.

Is it possible to load the editor with its own custom config, not using my already defined, custom dashboard version?

The width was an issue for me, so I would like to be able to over ride that is that possible using the editor element?, would I need to create my own additional options?

Thanks
jordanlev replied on at Permalink Reply
jordanlev
I think you can just put your custom config in a file and drop that into your site's "elements" directory, then in the code instead of:
Loader::element('editor_config');

...you would do this:
Loader::element('my_config_file_that_I_just_made');


(Note that you're not passing in the file extension to Loader::element)
glockops replied on at Permalink Reply
glockops
Should also be able to load elements from a package.
Loader::element("my_custom_element","my_package_handle");


Where the elements are in
packages
> my_package_handle
>> elements
>>> my_custom_element.php
Steff replied on at Permalink Reply
Steff
To load the config from your package you need to do
Loader::element('editor_init');
Loader::packageElement("your_config", "your_pkg_handler");


And Save the file in /packages/your_pkg/elements/your_config.php

Regards,
Steff