protected function getInlineJavaScript()
    {
        $options = array();

        if ($this->crop_width !== null) {
            $options['initWidth'] = $this->crop_width;
        }

        if ($this->crop_height !== null) {
            $options['initHeight'] = $this->crop_height;
        }

        $options['minWidth'] = intval($this->min_width);
        $options['minHeight'] = intval($this->min_height);

        if ($this->crop_height !== null) {
            $options['initHeight'] = $this->crop_height;
        }

        if ($this->crop_left !== null && $this->crop_top !== null) {
            $options['initialXY'] =
                '[' . $this->crop_left . ', ' . $this->crop_top . ']';
        }

        if ($this->crop_ratio !== null) {
            $options['ratio'] = 'true';
        }

        $options['status'] = 'false';

        $options_string = '';
        $first = true;

        foreach ($options as $key => $value) {
            if ($first) {
                $first = false;
            } else {
                $options_string .= ', ';
            }

            $options_string .= sprintf("%s: %s", $key, $value);
        }

        return sprintf(
            "%1\$s_obj = new SwatImageCropper(" . "'%1\$s', {%2\$s});",
            $this->id,
            $options_string
        );
    }