doAction( “area_close_button” )

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Actions
  6. doAction( “area_close_button” )
doAction( 'area_close_button', closeWrap, area );
doAction( 'area_close_button_{id}', closeWrap, area );

Action is fired once, during Area setup. Allows customization of the default close button after the button was attached to the area.

The {id} part in the hook name is the sanitized area-ID (all lower case, dashes changed to underscores).

Params

closeWrap
(jQuery) The close button wrapper element, that contains a single a-tag which is the actual close button.
area
(DiviAreaItem) The containing area object

Examples

// Display the text "close" inside the close button, instead of the X-icon.
DiviArea.addAction( 'area_close_button', function( closeWrap, area ) {
    closeWrap.find('a').text('close');
});

Notes

This action is fired before the init_area action. At that point, the close button will not be changed anymore.

The close button will be automatically shown or hidden when changing the area setting showClose or hideClose, like here:

area.setData( 'showClose', true );  // This has same effect as `closeWrap.show()`.
area.setData( 'hideClose', true );  // This has same effect as `closeWrap.hide()`.

Was this article helpful?

Related Articles