Automattic\WooCommerce\Admin\Notes
Note::add_action() public WC 1.0
Add an action to the note
{} Это метод класса: Note{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$Note = new Note(); $Note->add_action(;
Код Note::add_action() Note::add action WC 5.0.0
public function add_action(
$name,
$label,
$url = '',
$status = self::E_WC_ADMIN_NOTE_ACTIONED,
$primary = false,
$actioned_text = ''
) {
$name = wc_clean( $name );
$label = wc_clean( $label );
$query = esc_url_raw( $url );
$status = wc_clean( $status );
$primary = (bool) $primary;
$actioned_text = wc_clean( $actioned_text );
if ( empty( $name ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note action name prop cannot be empty.', 'woocommerce' ) );
}
if ( empty( $label ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note action label prop cannot be empty.', 'woocommerce' ) );
}
$action = array(
'name' => $name,
'label' => $label,
'query' => $query,
'status' => $status,
'primary' => $primary,
'actioned_text' => $actioned_text,
);
$note_actions = $this->get_prop( 'actions', 'edit' );
$note_actions[] = (object) $action;
$this->set_prop( 'actions', $note_actions );
}