پرش به محتویات

"Filter: bricks/form/submission-table/file_url"

URL فایل آپلود شده را که در جدول ارسال فرم در ناحیه مدیریت نمایش داده شده است فیلتر می‌کند. اگر دایرکتوری آپلود را سفارشی کرده باشید و URL تولید شده به طور خودکار نادرست باشد، مفید است.

پارامترها

  • $file_url (string): The generated URL for the file.
  • $file (array): Array containing file information (e.g., file path, name, type).
  • $field_key (string): The ID of the form field.

نمونه استفاده

add_filter( 'bricks/form/submission-table/file_url', function( $file_url, $file, $field_key ) {
    // Example: Fix URL for files in a custom 'secure-uploads' directory
    if ( strpos( $file['file'], 'secure-uploads' ) !== false ) {
        return site_url( '/secure-uploads/' . basename( $file['file'] ) );
    }

    return $file_url;
}, 10, 3 );