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", $closeButtonWrapper, area );
doAction( "area_close_button_{key}", $closeButtonWrapper, area );

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

The dynamic part of the filter name is the sanitized Area key. See DiviAreaItem.theKey() for details.

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