Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
BomAle Posted November 26, 2017 Posted November 26, 2017 I am trying to change default itemResult template with my custom template but it seem not work because \IPS\Helpers\Form\Item::html don't follow itemTemplate option. $template = NULL; if ( $this->options['itemTemplate'] === NULL ) { $template = array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' ), 'itemResult' ); } /* Are we getting some AJAX stuff? */ if ( isset( \IPS\Request::i()->_itemSelectName ) and \IPS\Request::i()->_itemSelectName === $this->name ) { /*.....*/ foreach( $class::getItemsWithPermission( $where, 'LENGTH(' . $field . ') ASC', array( 0, 20 ), $this->options['permissionCheck'] ) as $item ) { $results[] = array( 'id' => $item->$idField, 'html' => call_user_func( $template, $item ) ); } \IPS\Output::i()->json( $results ); } There is a future change about IPS developers? or I must use a theme hook inside itemResult and check if item is a instanceof a specific class? Thanks for support
teraßyte Posted November 26, 2017 Posted November 26, 2017 This is a bug I reported myself about a month ago, it should be fixed in 4.2.6 already though. The fix is to replace this code above: $template = NULL; if ( $this->options['itemTemplate'] === NULL ) { $template = array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' ), 'itemResult' ); } with this one: $template = NULL; if ( $this->options['itemTemplate'] === NULL ) { $template = array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' ), 'itemResult' ); } else { $template = $this->options['itemTemplate']; } EDIT: as a workaround in my own app I extended the form helper replacing the code with the fixed one until I upgrade to the version that contains the fix.
Daniel F Posted November 26, 2017 Posted November 26, 2017 I have fixed this an I can confirm that the recent release contains the fix. Just downloaded a fresh package from the client area and it contains indeed the fix:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.