ReyDev Posted April 13, 2022 Posted April 13, 2022 Hi, I want to change the title and text of the output modal of the confirmedDelete() method . I used this structrue but doesn't work \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' ); \\Doesn't work  Â
DawPi Posted April 13, 2022 Posted April 13, 2022 (edited) /** * Confirmation check * * @param string $title Lang string key for title * @param string $message Lang string key for confirm message * @param string $submit Lang string key for submit button * @param string $css CSS classes for the message * @return bool */ public function confirmedDelete( $title = 'delete_confirm', $message = 'delete_confirm_detail', $submit = 'delete', string $css = 'ipsMessage ipsMessage_warning' ) { It should work. Bug? Edited April 13, 2022 by DawPi
teraßyte Posted April 13, 2022 Posted April 13, 2022 (edited) In case you are trying to pass raw text it won't work, the code accepts only language keys. You can work around it doing something like this though: //<?php # First setup the language keys here \IPS\Member::loggedIn()->language()->words['new_title'] = "My New Title"; \IPS\Member::loggedIn()->language()->words['new_text'] = "My New Text"; # Then call confirmDelete() \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' );  Or just add the language keys to your app/plugin. 😋 Edited April 13, 2022 by teraßyte
ReyDev Posted April 13, 2022 Author Posted April 13, 2022 (edited) 37 minutes ago, teraßyte said: In case you are trying to pass raw text it won't work, the code accepts only language keys. You can work around it doing something like this though: //<?php # First setup the language keys here \IPS\Member::loggedIn()->language()->words['new_title'] = "My New Title"; \IPS\Member::loggedIn()->language()->words['new_text'] = "My New Text"; # Then call confirmDelete() \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' );  Or just add the language keys to your app/plugin. 😋 Doesn't work!!  i didn't use raw text, are lang keys, btw Edited April 13, 2022 by ReyDev
teraßyte Posted April 13, 2022 Posted April 13, 2022 Hmm, that's odd. I am using that function in my apps too.  What is your full code?
ReyDev Posted April 13, 2022 Author Posted April 13, 2022 1 minute ago, teraßyte said: What is your full code? public function delete() { \IPS\Session::i()->csrfCheck(); \IPS\Request::i()->confirmedDelete( 'new_title', 'new_text' ); //Some code } new_title and new_text are language keys in my app.Â
teraßyte Posted April 13, 2022 Posted April 13, 2022 That code definitely looks okay. Not really sure why it isn't working. 🤔 Maybe something else is preventing it from running. Do you have any php error logged perhaps?
ReyDev Posted April 13, 2022 Author Posted April 13, 2022 2 minutes ago, teraßyte said: That code definitely looks okay. Not really sure why it isn't working. 🤔 Maybe something else is preventing it from running. Do you have any php error logged perhaps? thanks for your help Â
Recommended Posts