M
M
Minusator2018-10-03 08:07:42
WordPress
Minusator, 2018-10-03 08:07:42

Why field check for file upload doesn't work?

Good day!
I'm trying to validate the Gif upload field (image_image) in a form before submitting.
Form fields

public function structure(){
            return [
                "title" => [
                    "type" => "field",
                    "name" => "title",
                    "label" => __("Title", "plugin-name"),
                    "field_type" => "text",
                    "rules" => [
                       "required",
                    ]
                ],
               "gif" => [
                    "type" => "group",
                    "name" => "gif",
                    "fields" => [
                        "image_image" => [
                            "type" => "field",
                            "name" => "image_image",
                            "label" => __("Browse File", "plugin-name"),
                            "field_type" => "file",
                            "rules" => [
                                "extensions" => "gif,mp4",
                                "maxSize" => zf_get_option("zombify_max_upload_size") / 1024
                            ],
                            "use_as_featured" => true
                        ]
                     ]
                ]
            ];
        }

Examination
class BBC_ZF_Tweaks {
  public static function edit_gif_quiz_structure( $structure ) {
    $structure[ 'gif/image_image' ] = true;

    return $structure;
  }

}

add_filter( 'plugin-name_structure_gif', array( 'BBC_ZF_Tweaks', 'edit_gif_quiz_structure' ), 10, 1 );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question