Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Modernize package for Neos 7.3 and newer #30

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions Classes/GeoPoint.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
<?php

namespace Ttree\GoogleMapEditor;

use Neos\Flow\Annotations as Flow;

/**
* @Flow\Proxy(false)
*/
final class GeoPoint implements \JsonSerializable
{
/**
* @var float
*/
protected $longitude;

/**
* @var float
*/
protected $latitude;

protected function __construct(float $latitude, float $longitude)
protected function __construct(protected float $latitude, protected float $longitude)
{
$this->latitude = $latitude;
$this->longitude = $longitude;
}

public static function create(float $latitude, float $longitude): GeoPoint
public static function create(float $latitude, float $longitude): self
{
return new static($latitude, $longitude);
return new self($latitude, $longitude);
}

public static function createFromArray(array $point): GeoPoint
public static function createFromArray(array $point): self
{
$point = \array_values($point);
list($latitude, $longitude) = $point;
return new static($latitude, $longitude);
[$latitude, $longitude] = $point;
return new self($latitude, $longitude);
}

public function getLongitude(): float
Expand Down
7 changes: 5 additions & 2 deletions Classes/GeoPointToArrayConverter.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

namespace Ttree\GoogleMapEditor;

use Neos\Error\Messages\Error;
use Neos\Flow\Property\Exception;
use Neos\Flow\Property\PropertyMappingConfigurationInterface;
use Neos\Flow\Property\TypeConverter\AbstractTypeConverter;
use Neos\Flow\Annotations as Flow;

/**
* @Flow\Proxy(false)
*/
final class GeoPointToArrayConverter extends AbstractTypeConverter
{
protected $sourceTypes = [GeoPoint::class];
Expand Down
6 changes: 4 additions & 2 deletions Classes/GeopointConverter.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php
namespace Ttree\GoogleMapEditor;

use Neos\Error\Messages\Error;
use Neos\Flow\Property\Exception;
use Neos\Flow\Property\PropertyMappingConfigurationInterface;
use Neos\Flow\Property\TypeConverter\AbstractTypeConverter;
use Neos\Flow\Annotations as Flow;

/**
* @Flow\Proxy(false)
*/
final class GeopointConverter extends AbstractTypeConverter
{
protected $sourceTypes = ['array', 'string'];
Expand Down
3 changes: 3 additions & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Neos:
javascript:
'Ttree.GoogleMapEditor:GeoPointEditor':
resource: resource://Ttree.GoogleMapEditor/Public/GeoPointEditor/Plugin.js
stylesheets:
'Ttree.GoogleMapEditor:GeoPointEditor':
resource: resource://Ttree.GoogleMapEditor/Public/GeoPointEditor/Plugin.css

userInterface:
translation:
Expand Down
42 changes: 42 additions & 0 deletions Public/GeoPointEditor/Plugin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* src/style.css */
.wrapper {
}
.wrapper--highlight {
outline: 2px solid var(--colors-Success);
}
.infoViewWrapper {
display: flex;
flex-direction: row;
}
.infoView {
composes: reset from "./reset.css";
user-select: none;
cursor: pointer;
display: inline-block;
vertical-align: top;
width: 100%;
line-height: 20px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
border: 2px solid var(--colors-ContrastNeutral);
background: var(--colors-ContrastNeutral);
font-size: var(--fontSize-Base);
padding: 7px var(--fontSize-Base);
margin: 0;
box-shadow: none;
transition: none;
}
.infoView--centered {
text-align: center;
padding: 0 14px 7px;
}
.mapWrapper {
border-bottom: 4px solid var(--colors-contrastBright);
}
.propertyLabel {
font-weight: bold;
}
.propertyValue {
font-size: var(--fontSize-Small);
}
Loading