Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
registration-3162526
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
registration-3162526
Commits
a247e7db
Commit
a247e7db
authored
11 years ago
by
Lev Tsypin
Browse files
Options
Downloads
Patches
Plain Diff
Punctuation.
parent
57d97963
No related branches found
Branches containing commit
Tags
tmp
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
includes/registration.field.inc
+13
-13
13 additions, 13 deletions
includes/registration.field.inc
with
13 additions
and
13 deletions
includes/registration.field.inc
+
13
−
13
View file @
a247e7db
...
...
@@ -51,7 +51,7 @@ function registration_field_instance_settings_form($field, $instance) {
$form
=
$form_state
=
array
();
$default_settings
=
isset
(
$instance
[
'settings'
][
'default_registration_settings'
])
?
$instance
[
'settings'
][
'default_registration_settings'
]
:
array
();
//
f
latten scheduling and reminder settings since this form is in tree mode
//
F
latten scheduling and reminder settings since this form is in tree mode
.
foreach
(
$default_settings
as
$key
=>
$val
)
{
if
(
$key
!=
'settings'
and
is_array
(
$val
))
{
foreach
(
$val
as
$key1
=>
$val1
)
{
...
...
@@ -77,7 +77,7 @@ function registration_field_instance_settings_form($field, $instance) {
'#description'
=>
t
(
'These settings will be applied when an entity with this field is saved and does not yet have it\'s own settings applied.'
)
);
//
u
nset the save button just in case
//
U
nset the save button just in case
.
unset
(
$settings_form
[
'save'
]);
$form
[
'default_registration_settings'
]
+=
$settings_form
;
...
...
@@ -133,7 +133,7 @@ function registration_field_widget_form(&$form, &$form_state, $field, $instance,
'#default_value'
=>
isset
(
$items
[
$delta
])
?
$items
[
$delta
]
:
array
(),
);
// force some help text into the field, appending anything the user add
d
ed.
// force some help text into the field, appending anything the user added.
$element
[
'#description'
]
.
=
' '
.
t
(
'Select what type of registrations should be
enabled for this @type. Depending on the display settings, it will appear
as either string, registration link, or form.'
,
array
(
'@type'
=>
$instance
[
'bundle'
]));
...
...
@@ -242,7 +242,7 @@ function registration_field_formatter_view($entity_type, $entity, $field, $insta
}
break
;
case
'registration_form'
:
//
e
nable registration link if accessible
//
E
nable registration link if accessible
.
list
(
$entity_id
)
=
entity_extract_ids
(
$entity_type
,
$entity
);
if
(
registration_register_page_access
(
$entity_type
,
$entity
)
&&
registration_status
(
$entity_type
,
$entity_id
))
{
$registration
=
entity_get_controller
(
'registration'
)
->
create
(
array
(
...
...
@@ -286,39 +286,39 @@ function registration_form_field_ui_field_edit_form_validate(&$form, &$form_stat
form_set_error
(
'cardinality'
,
t
(
'Cardinality on registration fields must be set to one.'
));
}
//
v
alidate default registration settings
//
V
alidate default registration settings
.
$default_settings
=
$form_state
[
'values'
][
'instance'
][
'settings'
][
'default_registration_settings'
];
$base_elem_key
=
'instance][settings][default_registration_settings]['
;
//
e
nsure capacity is a positive integer
//
E
nsure capacity is a positive integer
.
$capacity
=
$default_settings
[
'capacity'
];
if
(
!
is_numeric
(
$capacity
)
||
((
int
)
$capacity
!=
$capacity
)
||
(
$capacity
<
0
))
{
form_set_error
(
$base_elem_key
.
'capacity'
,
t
(
'Capacity must be a positive integer.'
));
}
//
v
alidate from address
//
V
alidate from address
.
if
(
!
valid_email_address
(
$default_settings
[
'settings'
][
'from_address'
]))
{
form_set_error
(
$base_elem_key
.
'settings][from_address'
,
t
(
'From email address is invalid.'
));
}
// Validate open date
// Validate open date
.
if
(
!
empty
(
$default_settings
[
'scheduling'
][
'open'
])
&&
strtotime
(
$default_settings
[
'scheduling'
][
'open'
])
===
FALSE
)
{
form_set_error
(
$base_elem_key
.
'scheduling][open'
,
t
(
'Date is invalid.'
));
}
// Validate close date
// Validate close date
.
if
(
!
empty
(
$default_settings
[
'scheduling'
][
'close'
])
&&
strtotime
(
$default_settings
[
'scheduling'
][
'close'
])
===
FALSE
)
{
form_set_error
(
$base_elem_key
.
'scheduling][close'
,
t
(
'Date is invalid.'
));
}
//
i
f sending a reminder, ensure date and template are set
//
I
f sending a reminder, ensure date and template are set
.
if
(
$default_settings
[
'reminder'
][
'send_reminder'
]
&&
(
empty
(
$default_settings
[
'reminder'
][
'reminder_settings'
][
'reminder_date'
])
||
empty
(
$default_settings
[
'reminder'
][
'reminder_settings'
][
'reminder_template'
])))
{
form_set_error
(
$base_elem_key
.
'reminder][send_reminder'
,
t
(
'If sending a reminder, provide a date and template.'
));
}
// Validate reminder date
// Validate reminder date
.
if
(
!
empty
(
$default_settings
[
'reminder'
][
'reminder_settings'
][
'reminder_date'
])
&&
strtotime
(
$default_settings
[
'reminder'
][
'reminder_settings'
][
'reminder_date'
])
===
FALSE
)
{
form_set_error
(
$base_elem_key
.
'reminder][reminder_settings][reminder_date'
,
t
(
'Reminder date is invalid.'
));
...
...
@@ -363,7 +363,7 @@ function registration_form_field_ui_field_overview_form_validate(&$form, &$form_
* Implements hook_field_create_instance().
*/
function
registration_field_create_instance
(
$instance
)
{
//
r
ebuild menu to recognize registration paths.
//
R
ebuild menu to recognize registration paths.
_registration_menu_rebuild
(
$instance
);
}
...
...
@@ -371,7 +371,7 @@ function registration_field_create_instance($instance) {
* Implements hook_field_delete_instance().
*/
function
registration_field_delete_instance
(
$instance
)
{
//
r
emove registration paths from menu router
//
R
emove registration paths from menu router
.
_registration_menu_rebuild
(
$instance
);
// @TODO: should we delete all registrations at this point?
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment