Elgg\Database\AdminNotices::delete PHP Method

delete() public method

eg In actions/twitter_service/save_settings: if (is_valid_twitter_api_key()) { delete_admin_notice('twitter_services_no_api'); }
public delete ( string $id ) : boolean
$id string The unique ID assigned in add_admin_notice()
return boolean
    function delete($id)
    {
        if (!$id) {
            return false;
        }
        $result = true;
        $notices = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'admin_notice', 'metadata_name' => 'admin_notice_id', 'metadata_value' => $id, 'limit' => false, 'batch' => true, 'batch_inc_offset' => false));
        // in case a bad plugin adds many, let it remove them all at once.
        foreach ($notices as $notice) {
            $result = $result && $notice->delete();
        }
        return $result;
    }