Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted June 22, 20168 yr I am try to override the template located on database > display > record (without custom edits or uploads a new template...) I am stopped because \IPS\cms\Theme::i()->getTemplate(...) don't call compileTemplates() when IN_DEV and then I cannot use developer center tried with theme hook( \IPS\Theme\class_cms_database_display ) with editing file \system\Plugin\Hook.php devTable() : foreach ( \IPS\Theme::load( \IPS\Theme::defaultTheme() )->getRawTemplates( null, null, null, \IPS\Theme::RETURN_ALL_NO_CONTENT ) as $app => $locations ) { foreach ( $locations as $location => $_groups ) { foreach ( $_groups as $group => $data ) { $groups[ $app ][ $app . '_' . $location . '_' . $group ] = "{$location}: {$group}"; } } } foreach ( \IPS\cms\Theme::i()->getRawTemplates( array(), array(), array(), \IPS\cms\Theme::RETURN_ONLY_TEMPLATE | \IPS\cms\Theme::RETURN_ALL_NO_CONTENT ) as $app => $locations ) { foreach ( $locations as $location => $_groups ) { foreach ( $_groups as $group => $data ) { $groups[ $app ][ $app . '_' . $location . '_' . $group ] = "{$location}: {$group}"; } } }
June 27, 20168 yr For what it's worth, this is on a shorter-term list of improvements we intend to make for third party developers. No promises, but it shouldn't be too far off.
December 2, 20177 yr Author any news on this? I am trying now overriding compileTemplate for inject a custom code: public static function compileTemplate( $content, $functionName, $params='', $isHTML=TRUE, $isCSS=FALSE, $app=null, $location=null, $group=null ) { if( $functionName == 'theme_cms_database_display_record' or ( $functionName == 'record' and $app == 'cms' and $location == 'database' and $group == 'display' ) ) { $content = static::themeHooks($content,[ [ 'selector' => 'article', 'type' => 'add_after', 'content' => '{{if $poll = $record->getPoll() AND $poll->displayTemplate = array( \IPS\Theme::i()->getTemplate( \'browse\', \'advpolls\', \'front\' ), \'display\' )}} {$poll|raw} <br> {{endif}}', ] ]); }
December 4, 20177 yr What are you ultimately trying to accomplish? I only ask because administrators can rename their templates and create new copies with different keys, so I'm not sure a general hook on a Pages template is really going to typically work. That said, I don't know what you are trying to accomplish either so I can't say for sure.
Archived
This topic is now archived and is closed to further replies.