Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
ephoto_dam
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
ephoto_dam
Commits
793c8f74
Commit
793c8f74
authored
Aug 24, 2020
by
ephoto_dam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ephoto Dam Field in progress
parent
d95110b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
32 deletions
+23
-32
modules/ephoto_dam_field/js/ephoto_dam_field.js
modules/ephoto_dam_field/js/ephoto_dam_field.js
+12
-22
modules/ephoto_dam_field/src/Plugin/Field/FieldType/EphotoDamField.php
...o_dam_field/src/Plugin/Field/FieldType/EphotoDamField.php
+8
-6
modules/ephoto_dam_field/src/Plugin/Field/FieldWidget/EphotoDamFieldWidget.php
...eld/src/Plugin/Field/FieldWidget/EphotoDamFieldWidget.php
+3
-4
No files found.
modules/ephoto_dam_field/js/ephoto_dam_field.js
View file @
793c8f74
...
...
@@ -86,13 +86,7 @@
this
.
ephoto
.
connect
();
if
(
this
.
settings
.
version_support
===
'
1
'
)
{
this
.
ephoto
.
File
.
callOnFileReceived
(
this
.
getVersionUrls
.
bind
(
this
));
}
else
{
this
.
ephoto
.
File
.
callOnFileReceived
(
this
.
getFileUrl
.
bind
(
this
));
}
this
.
ephoto
.
File
.
callOnFileReceived
(
this
.
getUrl
.
bind
(
this
));
this
.
ephoto
.
File
.
setMode
(
'
manual
'
);
...
...
@@ -123,18 +117,11 @@
this
.
ephoto
.
File
.
get
();
},
/**
*
*/
getVersionUrls
:
function
()
{
console
.
log
(
'
get version urls!
'
);
},
/**
*
*/
select
:
function
(
delta
)
{
select
File
:
function
(
delta
)
{
this
.
fieldSelected
=
this
.
_getFieldValues
()[
delta
];
if
(
!
this
.
fieldSelected
)
{
...
...
@@ -156,17 +143,18 @@
/**
*
*/
getFileUrl
:
function
()
{
console
.
log
(
'
get file url!
'
);
getUrl
:
function
()
{
var
self
=
this
;
var
version_support
=
this
.
settings
.
version_support
===
'
1
'
;
if
(
!
this
.
_
fieldSelected
)
{
if
(
!
this
.
fieldSelected
)
{
alert
(
Drupal
.
t
(
'
Field selection error
'
));
return
;
}
this
.
ephoto
.
File
.
store
(
function
(
url
)
{
this
.
_fieldSelected
.
value
=
url
;
this
.
_
fieldSelected
=
null
;
this
.
ephoto
.
File
.
store
(
function
(
url
)
{
self
.
fieldSelected
.
input
.
val
(
url
)
;
self
.
fieldSelected
=
null
;
});
},
...
...
@@ -176,11 +164,13 @@
_getFieldValues
:
function
()
{
var
fields
=
[];
var
sizes
=
$
(
'
.ephoto-dam-field-imagesize-field
'
).
toArray
();
var
inputs
=
$
(
'
.ephoto-dam-field-value-field
'
).
toArray
();
$
(
'
.ephoto-dam-field-version-field
'
).
map
(
function
(
index
,
el
)
{
fields
.
push
({
'
name
'
:
$
(
el
).
val
(),
'
size
'
:
$
(
sizes
[
index
]).
val
()
'
size
'
:
$
(
sizes
[
index
]).
val
(),
'
input
'
:
$
(
inputs
[
index
])
});
});
...
...
modules/ephoto_dam_field/src/Plugin/Field/FieldType/EphotoDamField.php
View file @
793c8f74
...
...
@@ -63,16 +63,16 @@ class EphotoDamField extends FieldItemBase {
*/
public
static
function
propertyDefinitions
(
FieldStorageDefinitionInterface
$field_definition
)
{
$properties
[
'value'
]
=
DataDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Url'
))
->
setRequired
(
true
);
->
setLabel
(
t
(
'Url'
))
;
//
->setRequired(true);
$properties
[
'image_size'
]
=
DataDefinition
::
create
(
'integer'
)
->
setLabel
(
t
(
'Image size'
))
->
setRequired
(
true
);
->
setLabel
(
t
(
'Image size'
))
;
//
->setRequired(true);
$properties
[
'version'
]
=
DataDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Version'
))
->
setRequired
(
true
);
->
setLabel
(
t
(
'Version'
))
;
//
->setRequired(true);
return
$properties
;
}
...
...
@@ -92,6 +92,8 @@ class EphotoDamField extends FieldItemBase {
* {@inheritdoc}
*/
public
function
fieldSettingsForm
(
array
$form
,
FormStateInterface
$form_state
)
{
$form
=
[];
$form
[
'server_url'
]
=
[
'#title'
=>
$this
->
t
(
'Server URL'
),
'#type'
=>
'url'
,
...
...
modules/ephoto_dam_field/src/Plugin/Field/FieldWidget/EphotoDamFieldWidget.php
View file @
793c8f74
...
...
@@ -38,7 +38,7 @@ class EphotoDamFieldWidget extends WidgetBase {
'#disabled'
=>
$is_default_values_form
,
'#attributes'
=>
[
'class'
=>
$classes
,
'onclick'
=>
'Drupal.ephotoDamField.selectVersion
Url
s();return false'
,
'onclick'
=>
'Drupal.ephotoDamField.selectVersions();return false'
,
'class'
=>
$classes
,
],
];
...
...
@@ -61,7 +61,7 @@ class EphotoDamFieldWidget extends WidgetBase {
$element
[
'image_size'
]
=
[
'#type'
=>
'number'
,
'#title'
=>
' '
,
'#default_value'
=>
isset
(
$items
[
$delta
]
->
image_size
)
?
$items
[
$delta
]
->
image_size
:
0
,
'#default_value'
=>
isset
(
$items
[
$delta
]
->
image_size
)
?
$items
[
$delta
]
->
image_size
:
null
,
'#disabled'
=>
!
$is_default_values_form
,
'#size'
=>
12
,
'#maxlength'
=>
60
,
...
...
@@ -69,7 +69,6 @@ class EphotoDamFieldWidget extends WidgetBase {
'#attributes'
=>
[
'class'
=>
[
'form-url'
,
'ephoto-dam-field-imagesize-field'
],
'placeholder'
=>
$this
->
t
(
'Image size'
),
'min'
=>
20
,
'max'
=>
1600
]
];
...
...
@@ -99,7 +98,7 @@ class EphotoDamFieldWidget extends WidgetBase {
'#disabled'
=>
$is_default_values_form
,
'#attributes'
=>
[
'class'
=>
$classes
,
'onclick'
=>
'Drupal.ephotoDamField.select
Url
('
.
$delta
.
');return false'
,
'onclick'
=>
'Drupal.ephotoDamField.select
File
('
.
$delta
.
');return false'
,
'class'
=>
$classes
]
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment