# give/4.16.8.1/src/FormAPI/Form/Media.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.8.1. 39 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.8.1/code/src/FormAPI/Form/Media.php
- Raw: https://pluginprobe.com/plugins/give/4.16.8.1/raw/src/FormAPI/Form/Media.php
- Modified: 2021-11-23T23:55:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.8.1/code/src/FormAPI/Form/Media.php#L10-L20`.

```php
<?php

namespace Give\FormAPI\Form;

class Media extends Field
{
    /**
     * Field value type.
     * Note: Allow developer to save attachment ID or attachment url as metadata.
     *
     * @since 2.7.0
     * @var string
     */
    public $fieldValueType;

    /**
     * @inheritDoc
     */
    public function parse($array)
    {
        parent::parse($array);

        $this->fieldValueType = isset($array['fvalue']) ? $array['fvalue'] : 'url';
    }

    /**
     * @inheritDoc
     */
    public function toArray()
    {
        return array_merge(
            parent::toArray(),
            [
                'fvalue' => $this->fieldValueType,
            ]
        );
    }
}

```
