newbie LAC Posted December 26, 2019 Share Posted December 26, 2019 Hello, I'm working on plugin and use \IPS\Helpers\Form\Node 'toggleIds' => array(), // Element IDs to toggle on when a node with 'togglePerm' permission IS selected - or, if togglePerm is NULL, an associtive array of elements to toggle when particular node IDs are selected if togglePerm is NULL, an associtive array of elements to toggle when particular node IDs are selected But this doesn't work \applications\core\dev\html\global\forms\nodeCascade.phtml {{if $togglePerm}}data-control="toggle" {{if $node->can( $togglePerm, NULL, $togglePermPBR )}}data-toggles="{expression="implode( ',', $toggleIds )"}"{{elseif !$togglePerm and isset( $toggleIds[ $node->_id ] )}}data-control="toggle" data-toggles="{expression="implode( ',', $toggleIds[ $node->_id ] )"}"{{elseif \count( $toggleIdsOff )}}data-toggles="{expression="implode( ',', $toggleIdsOff )"}"{{endif}}{{endif}} Some formatting {{if $togglePerm}} data-control="toggle" {{if $node->can( $togglePerm, NULL, $togglePermPBR )}} data-toggles="{expression="implode( ',', $toggleIds )"}" {{elseif !$togglePerm and isset( $toggleIds[ $node->_id ] )}} data-control="toggle" data-toggles="{expression="implode( ',', $toggleIds[ $node->_id ] )"}" {{elseif \count( $toggleIdsOff )}} data-toggles="{expression="implode( ',', $toggleIdsOff )"}" {{endif}} {{endif}} Link to comment Share on other sites More sharing options...
bfarber Posted January 2, 2020 Share Posted January 2, 2020 Can you provide a sample form you've created (minimal) that isn't working as expected? Link to comment Share on other sites More sharing options...
newbie LAC Posted January 4, 2020 Author Share Posted January 4, 2020 Just pay attention on condition If $togglePerm is NULL the toggle attributes will not be added. $form = new \IPS\Helpers\Form(); $form->add( new \IPS\Helpers\Form\Node( 'field1', 0, true, array( 'class' => 'IPS\calendar\Calendar', 'multiple' => false, 'toggleIds' => array( 1 => array( 'field2' ), 2 => array( 'field3' ) ), ) )); $form->add( new \IPS\Helpers\Form\Text( 'field2', '', true, array(), null, null, null, 'field2' )); $form->add( new \IPS\Helpers\Form\Text( 'field3', '', true, array(), null, null, null, 'field3' )); Link to comment Share on other sites More sharing options...
bfarber Posted January 6, 2020 Share Posted January 6, 2020 I've logged a bug report to have this looked into. Link to comment Share on other sites More sharing options...
bfarber Posted January 7, 2020 Share Posted January 7, 2020 I've confirmed this issue was actually already identified and fixed for 4.5. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.