- Posts: 6
COMMUNITY FORUM
[PLUGIN] - Admin Form
- Clint De Battista
-
Topic Author
- Offline
- New Member
Less
More
10 years 10 months ago - 10 years 10 months ago #129662
by Clint De Battista
[PLUGIN] - Admin Form was created by Clint De Battista
function onRenderAdminForm(&$item, $type, $tabs = '') {
if ($tabs == 'extrafields') {
$mainframe = JFactory::getApplication();
$path = "item-extrafields";
$manifest = '
<?xml version="1.0" encoding="utf-8"?>
<extension>
<fields group="item-extrafields" label="Saisons">
<field name="saison1" label ="PLG_K2_EXTRAFIELDS_LABEL_SAISON1" type="editor" width="100%" filter="safehtml" buttons="true" />
</fields>
</extension>';
jimport('joomla.form.form');
$form = JForm::getInstance('plg_k2_'.$this->pluginName.'_'.$path, $manifest, array(), true, 'fields[@group="'.$path.'"]');
$fields = '';
foreach ($form->getFieldset() as $field)
{
$search = 'name="'.$field->name.'"';
$replace = 'name="plugins"';
$input = JString::str_ireplace($search, $replace, $field->__get('input'));
$fields .= $field->__get('label').' '.$input;
}
if ($fields)
{
$plugin = new stdClass;
$plugin->name = $this->pluginNameHumanReadable;
$plugin->fields = $fields;
$doc = JFactory::getDocument();
$js = "
c = window.parent.tinyMCE;
d = 'wtfffffffffffff';
//document.getElement('#' + c).set('value', d);
console.log(c);
";
$doc->addScriptDeclaration($js);
return $plugin;
}
//JLog::add('le(s) colonne(s): ' . print_r($plugin, true) . ' n\'existe(nt) pas');
}
}
This is on my plugin. Everythings works good but when I save I don't have on my editor the last "text" but it's stored on database.
Do I have to use an alternative to "restore" the text from the database ?
if ($tabs == 'extrafields') {
$mainframe = JFactory::getApplication();
$path = "item-extrafields";
$manifest = '
<?xml version="1.0" encoding="utf-8"?>
<extension>
<fields group="item-extrafields" label="Saisons">
<field name="saison1" label ="PLG_K2_EXTRAFIELDS_LABEL_SAISON1" type="editor" width="100%" filter="safehtml" buttons="true" />
</fields>
</extension>';
jimport('joomla.form.form');
$form = JForm::getInstance('plg_k2_'.$this->pluginName.'_'.$path, $manifest, array(), true, 'fields[@group="'.$path.'"]');
$fields = '';
foreach ($form->getFieldset() as $field)
{
$search = 'name="'.$field->name.'"';
$replace = 'name="plugins"';
$input = JString::str_ireplace($search, $replace, $field->__get('input'));
$fields .= $field->__get('label').' '.$input;
}
if ($fields)
{
$plugin = new stdClass;
$plugin->name = $this->pluginNameHumanReadable;
$plugin->fields = $fields;
$doc = JFactory::getDocument();
$js = "
c = window.parent.tinyMCE;
d = 'wtfffffffffffff';
//document.getElement('#' + c).set('value', d);
console.log(c);
";
$doc->addScriptDeclaration($js);
return $plugin;
}
//JLog::add('le(s) colonne(s): ' . print_r($plugin, true) . ' n\'existe(nt) pas');
}
}
This is on my plugin. Everythings works good but when I save I don't have on my editor the last "text" but it's stored on database.
Do I have to use an alternative to "restore" the text from the database ?
Please Log in or Create an account to join the conversation.
- Clint De Battista
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 6
10 years 10 months ago #129663
by Clint De Battista
Replied by Clint De Battista on topic Re: [PLUGIN] - Admin Form
Forum dead?
Please Log in or Create an account to join the conversation.
- Abu Reviewer
-
- Offline
- New Member
Less
More
- Posts: 2
10 years 5 months ago - 10 years 5 months ago #134119
by Abu Reviewer
Replied by Abu Reviewer on topic [PLUGIN] - Admin Form
I too need a solution for this problem did you find any solution?
Last edit: 10 years 5 months ago by Abu Reviewer. Reason: Spelling mistake
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 5 months ago #134141
by Lefteris
Replied by Lefteris on topic [PLUGIN] - Admin Form
@Clint De Battista
Hi. What exactly are you trying to achieve with this code? You don't need to override this function in your plugin. A good place to start when writing K2 plugins is the example K2 plugin at github.com/joomlaworks/example-k2-plugin .
Hi. What exactly are you trying to achieve with this code? You don't need to override this function in your plugin. A good place to start when writing K2 plugins is the example K2 plugin at github.com/joomlaworks/example-k2-plugin .
Please Log in or Create an account to join the conversation.