PHP code example of quantum-dragons / image-map-field

1. Go to this page and download the library: Download quantum-dragons/image-map-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

quantum-dragons / image-map-field example snippets


    
    use ImageMapField\Forms\ImageMapField;
    use ImageMapField\Traits\ProcessMapData;
    
    class TestPage {

        use ProcessMapData;

        private static $db = [
            'ProcessMapData' => 'Text',
        ];

        private static $has_one = [
            'ProcessMapImage' => Image::class,
        ];

        public function getCMSFields()
        {
            $fields = parent::getCMSFields();
            $fields->addFieldToTab(
                'Root.Main',
                ImageMapField::create('ProcessMapData', 'ProcessMapData')
                    ->setImage($this->ProcessMapImage()),
            );
        }

        ...
    }