RTMediaUserInteraction::__construct PHP Method

__construct() public method

Initialise the user interaction
public __construct ( array $args = [] )
$args array
    function __construct($args = array())
    {
        $defaults = array('action' => '', 'label' => '', 'plural' => '', 'undo_label' => '', 'privacy' => 60, 'countable' => false, 'single' => false, 'repeatable' => false, 'undoable' => false, 'icon_class' => '');
        $args = wp_parse_args($args, $defaults);
        foreach ($args as $key => $val) {
            $this->{$key} = $val;
        }
        $this->init();
        // filter the default actions with this new one
        add_filter('rtmedia_query_actions', array($this, 'register'));
        // hook into the template for this action
        add_action('rtmedia_pre_action_' . $this->action, array($this, 'preprocess'));
        add_filter('rtmedia_action_buttons_before_delete', array($this, 'button_filter'));
    }

Usage Example

 function __construct()
 {
     $args = array('action' => 'view', 'label' => 'view', 'privacy' => 0);
     parent::__construct($args);
     remove_filter('rtmedia_action_buttons_before_delete', array($this, 'button_filter'));
     add_filter('rtmedia_action_buttons_after_delete', array($this, 'button_filter'), 99);
 }
All Usage Examples Of RTMediaUserInteraction::__construct