We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Delete Confirmation

Development and Programming

Aquarian Web Studio's avatar
Aquarian Web Studio
193 posts
16 years ago
Aquarian Web Studio's avatar Aquarian Web Studio

Hey there

I’m trying to make use of the Display Class’s built-in confirmation with the following code:

$r = $DSP->delete_confirmation(
                        array(
                                'url'        => 'C=modules'.AMP.'M=documents'.AMP.'P=delete_class_confirm',
                                'heading'    => 'delete_module_heading',
                                'message'    => 'Are you sure you would like to delete this classification? All associated documents will also be deleted.',
                                'item'    => $delete_query->row['class_name'],
                                'extra'    => 'This is extra',
                                'hidden'    => array('class_key' =>  $IN->GBL('class_key'))
                            )
                        );   
         $DSP->body = $r;

.. and all I get is this (lousy 😉 display: (see attachment)

From what I can tell, I have followed everything fine, which is reflected by the delete screen appearing, but no heading? No message? Its a little strange.

I have not yet tested it for function.

Is anyone able to spot what i might be doing wrong or have any tips/tricks to get this to work?

Thanks.

EDIT:: Strangely, its the passed variable “$delete_query->row[‘class_name’]” that’s providing the correct item name in green.

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

All the text (heading, message, and extra) needs to be in language variables. So you’ll need to move the message to a language file and then make sure that they’re all accessible (try it with $LANG->line($key)).

Hope that helps.

       
Aquarian Web Studio's avatar
Aquarian Web Studio
193 posts
16 years ago
Aquarian Web Studio's avatar Aquarian Web Studio

Unfortunately, that’s not what’s up. Now I have:

$r = $DSP->delete_confirmation(
                        array(
                                'url'        => 'C=modules'.AMP.'M=documents'.AMP.'P=delete_class_confirm',
                                'heading'    => $LANG->line('delete_class'),
                                'message'    => $LANG->line('delete_class_msg'),
                                'item'    => $delete_query->row['class_name'],
                                'extra'    => 'This is extra',
                                'hidden'    => array('class_key' =>  $IN->GBL('class_key'))
                            )
                        ); 
                        
                         
         $DSP->body = $r;

Global $LANG is being pulled.. and yet the delete_confirmation is identical to the previous.

But logically, it shouldn’t require pulling a string from a Lang file to populate a variable with a string..

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

Sorry, I meant it requires the language keys. The $LANG->line is done internally, but you can use that by itself to make sure that the language variables are actually there.

So something like this:

$r = $DSP->delete_confirmation(
                        array(
                                'url'        => 'C=modules'.AMP.'M=documents'.AMP.'P=delete_class_confirm',
                                'heading'    => 'delete_class',
                                'message'    => 'delete_class_msg',
                                'item'    => $delete_query->row['class_name'],
                                'extra'    => 'This is extra',
                                'hidden'    => array('class_key' =>  $IN->GBL('class_key'))
                            )
                        );
       
Aquarian Web Studio's avatar
Aquarian Web Studio
193 posts
16 years ago
Aquarian Web Studio's avatar Aquarian Web Studio

Heh OK now I get it. And that works perfectly.

You’re a legend!

.ccb.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.