Alexandru Posted June 1, 2023 Posted June 1, 2023 (edited) So I see there is another editor so to say where Header / Footer HTML is and I also want to use it but I can't figure out how. Examples.Invisioncommunity:Mine: I want to make it show exactly like Header and Footer editor. help? I think I can access it and make it show through Custom PHP, but I don't know where to select it. There is no documentation for it. If i use it as shown in my example it will display like this and that's why I want it like in Header/Footer. Edited June 1, 2023 by drawncodes
Alexandru Posted June 2, 2023 Author Posted June 2, 2023 (edited) Well, I guess there is no one here with a solution. I'll try to find something to work around it. @Jim M any thoughts?? Edited June 2, 2023 by drawncodes
Nathan Explosion Posted June 20, 2023 Posted June 20, 2023 If I read the above correctly, you will want to be using a Codemirror helper, and not a Text helper. A quick look at system\Theme\Theme.php for the theme_simple_header_settings and theme_simple_footer_settings fields gives the answer. Alexandru 1
Management Matt Posted June 21, 2023 Management Posted June 21, 2023 As Nathan said, make sure you're using a CodeMirror editor type, eg. $form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) ); Alexandru and G17 Media 1 1
Alexandru Posted June 21, 2023 Author Posted June 21, 2023 3 minutes ago, Matt said: As Nathan said, make sure you're using a CodeMirror editor type, eg. $form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) ); Uhhhh, thank you ❤️
Alexandru Posted June 21, 2023 Author Posted June 21, 2023 23 hours ago, Nathan Explosion said: If I read the above correctly, you will want to be using a Codemirror helper, and not a Text helper. A quick look at system\Theme\Theme.php for the theme_simple_header_settings and theme_simple_footer_settings fields gives the answer. 14 minutes ago, Matt said: As Nathan said, make sure you're using a CodeMirror editor type, eg. $form->add( new \IPS\Helpers\Form\Codemirror( 'theme_simple_header_settings', $this->custom_header, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ] ) ); Thank you both, I did it: Matt 1
Alexandru Posted June 22, 2023 Author Posted June 22, 2023 Now I have another problem, which is this. @Matt
Stuart Silvester Posted June 22, 2023 Posted June 22, 2023 You cannot save template logic in a theme setting and expect it to work when you include it. It has to be in a template and called properly as a template.
Alexandru Posted June 22, 2023 Author Posted June 22, 2023 (edited) 4 hours ago, Stuart Silvester said: You cannot save template logic in a theme setting and expect it to work when you include it. It has to be in a template and called properly as a template. Ohh I see, but I already tried it, and still doesn't work.. am I doing smth wrong? Edited June 22, 2023 by drawncodes
Alexandru Posted July 5, 2023 Author Posted July 5, 2023 <?php // Create a form using defaults $form = new \IPS\Helpers\Form; $form->add(new \IPS\Helpers\Form\Codemirror( "core_theme_setting_title_{$row['sc_id']}", $value, FALSE, [ 'mode' => 'htmlmixed', 'height' => 400 ], NULL, NULL, NULL, 'theme_setting_' . $row['sc_key'] )); // Send the form for output \IPS\Output::i()->output = $form; So we did some testing with this code from above and also the code from Theme.php and we were trying to replicate it directly in the Designer Mode custom settings for the fields I've created. /** * Get theme header and footer * * @return array */ public function getHeaderAndFooter(): array { $return = [ 'header' => null, 'footer' => null ]; if ( $this->custom_header ) { $key = 'custom_header_' . $this->_id; if ( ! isset( \IPS\Data\Store::i()->$key ) ) { \IPS\Data\Store::i()->$key = static::compileTemplate( $this->custom_header, NULL ); } $return['header'] = \IPS\Data\Store::i()->$key; } if ( $this->custom_footer ) { $key = 'custom_footer_' . $this->_id; if ( ! isset( \IPS\Data\Store::i()->$key ) ) { \IPS\Data\Store::i()->$key = static::compileTemplate( $this->custom_footer, NULL ); } $return['footer'] = \IPS\Data\Store::i()->$key; } return $return; } We want to know what limits we have in designer mode at customizing tabs and adding form through custom/manual PHP.
Lisa Lightner Posted April 23 Posted April 23 I'm having trouble doing this. Did you ever get a solution? @Alexandru
Alexandru Posted April 28 Author Posted April 28 On 4/23/2024 at 2:37 PM, Lisa Lightner said: I'm having trouble doing this. Did you ever get a solution? @Alexandru Nope. I didn't try to get it working anymore.
Recommended Posts