Jump to content

Recommended Posts

Posted

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

 

 

Posted (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 by DawPi
Posted (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 by teraßyte
Posted (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 by ReyDev
Posted
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. 

Posted
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
 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...