Jump to content

How to customize the title and text of the confirmedDelete() method?


Recommended Posts

	/**
	 * 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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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
 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...