name = sanitize_title( $name ); $this->label = __( esc_attr( $label) ); $this->value = $value; } function set_field_instance( $instance, $field ) { $field->instance = $instance; } function set_field_identifiers( $field, $uid = null ) { // we MUST have an instance if( empty( $field->instance ) ) return false; // if we're pulling an existing Attachment (field has a value) we're going to use // a PHP uniqid to set up our array flags but if we're setting up our Underscore // template we need to use a variable flag to be processed later $this->uid = !is_null( $uid ) ? $uid : '{{ attachments.attachment_uid }}'; // set the name $field->field_name = "attachments[$field->instance][$this->uid][fields][$field->name]"; // set the id $field->field_id = $this->field_name . $this->uid; } function set_field_type( $field_type ) { $this->type = $field_type; } public function html( $field ) { ?>