Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
4310e905
Commit
4310e905
authored
Dec 30, 2016
by
Χάρης Παπαδόπουλος
Browse files
initial app skeleton with sample drupal modules for testing
parents
Changes
131
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
4310e905
dist/*
node_modules/*
!drupal/
drupal/*
!drupal/modules/
drupal/modules/*
!drupal/modules/epal/
!drupal/modules/epalreadydata/
# Logs
*.log
# Runtime data
pids
*.pid
*.seed
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Sass cache folder
.sass-cache
# Users Environment Variables
npm-debug*
# bower_components
# Project reference
# typings
drupal/modules/epal/composer.json
0 → 100644
View file @
4310e905
{
"name"
:
"drupal/epal"
,
"type"
:
"drupal-module"
,
"description"
:
"EPAL Registration"
,
"keywords"
:
[
"Drupal"
],
"license"
:
"GPL-2.0+"
,
"homepage"
:
"https://www.drupal.org/project/epal"
,
"minimum-stability"
:
"dev"
,
"support"
:
{
"issues"
:
"https://www.drupal.org/project/issues/epal"
,
"source"
:
"http://cgit.drupalcode.org/epal"
},
"require"
:
{
}
}
drupal/modules/epal/epal.info.yml
0 → 100644
View file @
4310e905
name
:
epal
type
:
module
description
:
EPAL Registration
core
:
8.x
package
:
epal
drupal/modules/epal/epal.links.action.yml
0 → 100644
View file @
4310e905
entity.epal_student.add_form
:
route_name
:
entity.epal_student.add_form
title
:
'
Add
EPAL
Student'
appears_on
:
-
entity.epal_student.collection
entity.epal_student_class.add_form
:
route_name
:
entity.epal_student_class.add_form
title
:
'
Add
EPAL
Student
Class'
appears_on
:
-
entity.epal_student_class.collection
drupal/modules/epal/epal.links.menu.yml
0 → 100644
View file @
4310e905
# EPAL Student menu items definition
entity.epal_student.collection
:
title
:
'
EPAL
Student
list'
route_name
:
entity.epal_student.collection
description
:
'
List
EPAL
Student
entities'
parent
:
system.admin_epal
weight
:
100
epal_student.admin.structure.settings
:
title
:
EPAL Student settings
description
:
'
Configure
EPAL
Student
entities'
route_name
:
epal_student.settings
parent
:
system.admin_structure
# EPAL Student Class menu items definition
entity.epal_student_class.collection
:
title
:
'
EPAL
Student
Class
list'
route_name
:
entity.epal_student_class.collection
description
:
'
List
EPAL
Student
Class
entities'
parent
:
system.admin_epal
weight
:
100
epal_student_class.admin.structure.settings
:
title
:
EPAL Student Class settings
description
:
'
Configure
EPAL
Student
Class
entities'
route_name
:
epal_student_class.settings
parent
:
system.admin_structure
drupal/modules/epal/epal.links.task.yml
0 → 100644
View file @
4310e905
# EPAL Student routing definition
epal_student.settings_tab
:
route_name
:
epal_student.settings
title
:
'
Settings'
base_route
:
epal_student.settings
entity.epal_student.canonical
:
route_name
:
entity.epal_student.canonical
base_route
:
entity.epal_student.canonical
title
:
'
View'
entity.epal_student.edit_form
:
route_name
:
entity.epal_student.edit_form
base_route
:
entity.epal_student.canonical
title
:
'
Edit'
entity.epal_student.delete_form
:
route_name
:
entity.epal_student.delete_form
base_route
:
entity.epal_student.canonical
title
:
Delete
weight
:
10
# EPAL Student Class routing definition
epal_student_class.settings_tab
:
route_name
:
epal_student_class.settings
title
:
'
Settings'
base_route
:
epal_student_class.settings
entity.epal_student_class.canonical
:
route_name
:
entity.epal_student_class.canonical
base_route
:
entity.epal_student_class.canonical
title
:
'
View'
entity.epal_student_class.edit_form
:
route_name
:
entity.epal_student_class.edit_form
base_route
:
entity.epal_student_class.canonical
title
:
'
Edit'
entity.epal_student_class.delete_form
:
route_name
:
entity.epal_student_class.delete_form
base_route
:
entity.epal_student_class.canonical
title
:
Delete
weight
:
10
drupal/modules/epal/epal.module
0 → 100644
View file @
4310e905
<?php
/**
* @file
* Contains epal.module.
*/
use
Drupal\Core\Routing\RouteMatchInterface
;
/**
* Implements hook_help().
*/
function
epal_help
(
$route_name
,
RouteMatchInterface
$route_match
)
{
switch
(
$route_name
)
{
// Main module help for the epal module.
case
'help.page.epal'
:
$output
=
''
;
$output
.
=
'<h3>'
.
t
(
'About'
)
.
'</h3>'
;
$output
.
=
'<p>'
.
t
(
'EPAL Registration'
)
.
'</p>'
;
return
$output
;
default
:
}
}
/**
* Implements hook_theme().
*/
function
epal_theme
()
{
return
[
'epal'
=>
[
'template'
=>
'epal'
,
'render element'
=>
'children'
,
],
];
}
drupal/modules/epal/epal.permissions.yml
0 → 100644
View file @
4310e905
add epal student entities
:
title
:
'
Create
new
EPAL
Student
entities'
administer epal student entities
:
title
:
'
Administer
EPAL
Student
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
EPAL
Student
entities.'
restrict access
:
true
delete epal student entities
:
title
:
'
Delete
EPAL
Student
entities'
edit epal student entities
:
title
:
'
Edit
EPAL
Student
entities'
access epal student overview
:
title
:
'
Access
the
EPAL
Student
overview
page'
view published epal student entities
:
title
:
'
View
published
EPAL
Student
entities'
view unpublished epal student entities
:
title
:
'
View
unpublished
EPAL
Student
entities'
add epal student class entities
:
title
:
'
Create
new
EPAL
Student
Class
entities'
administer epal student class entities
:
title
:
'
Administer
EPAL
Student
Class
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
EPAL
Student
Class
entities.'
restrict access
:
true
delete epal student class entities
:
title
:
'
Delete
EPAL
Student
Class
entities'
edit epal student class entities
:
title
:
'
Edit
EPAL
Student
Class
entities'
access epal student class overview
:
title
:
'
Access
the
EPAL
Student
Class
overview
page'
view published epal student class entities
:
title
:
'
View
published
EPAL
Student
Class
entities'
view unpublished epal student class entities
:
title
:
'
View
unpublished
EPAL
Student
Class
entities'
drupal/modules/epal/epal_student.page.inc
0 → 100644
View file @
4310e905
<?php
/**
* @file
* Contains epal_student.page.inc.
*
* Page callback for EPAL Student entities.
*/
use
Drupal\Core\Render\Element
;
/**
* Prepares variables for EPAL Student templates.
*
* Default template: epal_student.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function
template_preprocess_epal_student
(
array
&
$variables
)
{
// Fetch EpalStudent Entity Object.
$epal_student
=
$variables
[
'elements'
][
'#epal_student'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/epal/epal_student_class.page.inc
0 → 100644
View file @
4310e905
<?php
/**
* @file
* Contains epal_student_class.page.inc.
*
* Page callback for EPAL Student Class entities.
*/
use
Drupal\Core\Render\Element
;
/**
* Prepares variables for EPAL Student Class templates.
*
* Default template: epal_student_class.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function
template_preprocess_epal_student_class
(
array
&
$variables
)
{
// Fetch EpalStudentClass Entity Object.
$epal_student_class
=
$variables
[
'elements'
][
'#epal_student_class'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/epal/src/Entity/EpalStudent.php
0 → 100644
View file @
4310e905
<?php
namespace
Drupal\epal\Entity
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Drupal\Core\Field\BaseFieldDefinition
;
use
Drupal\Core\Entity\ContentEntityBase
;
use
Drupal\Core\Entity\EntityChangedTrait
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\user\UserInterface
;
/**
* Defines the EPAL Student entity.
*
* @ingroup epal
*
* @ContentEntityType(
* id = "epal_student",
* label = @Translation("EPAL Student"),
* handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\epal\EpalStudentListBuilder",
* "views_data" = "Drupal\epal\Entity\EpalStudentViewsData",
* "translation" = "Drupal\epal\EpalStudentTranslationHandler",
*
* "form" = {
* "default" = "Drupal\epal\Form\EpalStudentForm",
* "add" = "Drupal\epal\Form\EpalStudentForm",
* "edit" = "Drupal\epal\Form\EpalStudentForm",
* "delete" = "Drupal\epal\Form\EpalStudentDeleteForm",
* },
* "access" = "Drupal\epal\EpalStudentAccessControlHandler",
* "route_provider" = {
* "html" = "Drupal\epal\EpalStudentHtmlRouteProvider",
* },
* },
* base_table = "epal_student",
* data_table = "epal_student_field_data",
* translatable = TRUE,
* admin_permission = "administer epal student entities",
* entity_keys = {
* "id" = "id",
* "label" = "name",
* "uuid" = "uuid",
* "uid" = "user_id",
* "langcode" = "langcode",
* "status" = "status",
* "surname" = "surname",
* "address" = "address",
* "birthdate" = "birthdate",
* "epalstudentclass_id" = "epalstudentclass_id",
* },
* links = {
* "canonical" = "/admin/epal/epal_student/{epal_student}",
* "add-form" = "/admin/epal/epal_student/add",
* "edit-form" = "/admin/epal/epal_student/{epal_student}/edit",
* "delete-form" = "/admin/epal/epal_student/{epal_student}/delete",
* "collection" = "/admin/epal/epal_student",
* },
* field_ui_base_route = "epal_student.settings"
* )
*/
class
EpalStudent
extends
ContentEntityBase
implements
EpalStudentInterface
{
use
EntityChangedTrait
;
/**
* {@inheritdoc}
*/
public
static
function
preCreate
(
EntityStorageInterface
$storage_controller
,
array
&
$values
)
{
parent
::
preCreate
(
$storage_controller
,
$values
);
$values
+=
array
(
'user_id'
=>
\
Drupal
::
currentUser
()
->
id
(),
);
}
/**
* {@inheritdoc}
*/
public
function
getName
()
{
return
$this
->
get
(
'name'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setName
(
$name
)
{
$this
->
set
(
'name'
,
$name
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getCreatedTime
()
{
return
$this
->
get
(
'created'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setCreatedTime
(
$timestamp
)
{
$this
->
set
(
'created'
,
$timestamp
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getOwner
()
{
return
$this
->
get
(
'user_id'
)
->
entity
;
}
/**
* {@inheritdoc}
*/
public
function
getOwnerId
()
{
return
$this
->
get
(
'user_id'
)
->
target_id
;
}
/**
* {@inheritdoc}
*/
public
function
setOwnerId
(
$uid
)
{
$this
->
set
(
'user_id'
,
$uid
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
setOwner
(
UserInterface
$account
)
{
$this
->
set
(
'user_id'
,
$account
->
id
());
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
isPublished
()
{
return
(
bool
)
$this
->
getEntityKey
(
'status'
);
}
/**
* {@inheritdoc}
*/
public
function
setPublished
(
$published
)
{
$this
->
set
(
'status'
,
$published
?
TRUE
:
FALSE
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getSurname
()
{
return
$this
->
get
(
'surname'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setSurname
(
$surname
)
{
$this
->
set
(
'surname'
,
$surname
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getAddress
()
{
return
$this
->
get
(
'address'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setAddress
(
$address
)
{
$this
->
set
(
'address'
,
$address
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getBirthdate
()
{
return
$this
->
get
(
'birthdate'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setBirthdate
(
$birthdate
)
{
$this
->
set
(
'birthdate'
,
$birthdate
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getEpalstudentclass
()
{
return
$this
->
get
(
'epalstudentclass_id'
)
->
entity
;
}
/**
* {@inheritdoc}
*/
public
function
getEpalstudentclassId
()
{
return
$this
->
get
(
'epalstudentclass_id'
)
->
target_id
;
}
/**
* {@inheritdoc}
*/
public
function
setEpalstudentclassId
(
$epalstudentclass_id
)
{
$this
->
set
(
'epalstudentclass_id'
,
$epalstudentclass_id
);
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
setEpalstudentclass
(
EpalStudentClassInterface
$epalstudentclass
)
{
$this
->
set
(
'epalstudentclass_id'
,
$epalstudentclass
->
id
());
return
$this
;
}
/**
* {@inheritdoc}
*/
public
static
function
baseFieldDefinitions
(
EntityTypeInterface
$entity_type
)
{
$fields
=
parent
::
baseFieldDefinitions
(
$entity_type
);
$fields
[
'user_id'
]
=
BaseFieldDefinition
::
create
(
'entity_reference'
)
->
setLabel
(
t
(
'Authored by'
))
->
setDescription
(
t
(
'The user ID of author of the EPAL Student entity.'
))
->
setRevisionable
(
TRUE
)
->
setSetting
(
'target_type'
,
'user'
)
->
setSetting
(
'handler'
,
'default'
)
->
setTranslatable
(
TRUE
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'hidden'
,
'type'
=>
'author'
,
'weight'
=>
0
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'entity_reference_autocomplete'
,
'weight'
=>
5
,
'settings'
=>
array
(
'match_operator'
=>
'CONTAINS'
,
'size'
=>
'60'
,
'autocomplete_type'
=>
'tags'
,
'placeholder'
=>
''
,
),
))
->
setDisplayConfigurable
(
'form'
,
TRUE
)
->
setDisplayConfigurable
(
'view'
,
TRUE
);
$fields
[
'name'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Name'
))
->
setDescription
(
t
(
'The name of the EPAL Student entity.'
))
->
setSettings
(
array
(
'max_length'
=>
50
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
''
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
TRUE
)
->
setDisplayConfigurable
(
'view'
,
TRUE
);
$fields
[
'status'
]
=
BaseFieldDefinition
::
create
(
'boolean'
)
->
setLabel
(
t
(
'Publishing status'
))
->
setDescription
(
t
(
'A boolean indicating whether the EPAL Student is published.'
))
->
setDefaultValue
(
TRUE
);
$fields
[
'created'
]
=
BaseFieldDefinition
::
create
(
'created'
)
->
setLabel
(
t
(
'Created'
))
->
setDescription
(
t
(
'The time that the entity was created.'
));
$fields
[
'changed'
]
=
BaseFieldDefinition
::
create
(
'changed'
)
->
setLabel
(
t
(
'Changed'
))
->
setDescription
(
t
(
'The time that the entity was last edited.'
));
$fields
[
'surname'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Surname'
))
->
setDescription
(
t
(
'The surname of the Student entity.'
))
->
setSettings
(
array
(
'max_length'
=>
100
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
''
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'string_textfield'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
TRUE
)
->
setDisplayConfigurable
(
'view'
,
TRUE
);
$fields
[
'address'
]
=
BaseFieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Address'
))
->
setDescription
(
t
(
'The address of the Student entity.'
))
->
setSettings
(
array
(
'max_length'
=>
255
,
'text_processing'
=>
0
,
))
->
setDefaultValue
(
''
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'string'
,
'weight'
=>
-
4
,