Skip to content

Commit

Permalink
Merge pull request #403 from compucorp/staging
Browse files Browse the repository at this point in the history
Sync master with staging
  • Loading branch information
davialexandre authored Nov 27, 2017
2 parents 855a769 + da8be1e commit 9c55a5f
Show file tree
Hide file tree
Showing 67 changed files with 14,473 additions and 4,777 deletions.
2 changes: 2 additions & 0 deletions civihr_employee_portal/civihr_employee_portal.info
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ files[] = views/includes/civihr_employee_portal_argument_date_range.inc
files[] = views/includes/civihr_employee_portal_argument_contact_id.inc
files[] = views/includes/civihr_employee_portal_handler_email.inc
files[] = views/includes/civihr_employee_portal_handler_age_group.inc
files[] = views/includes/civihr_employee_portal_handler_aggregated_address.inc
files[] = views/includes/civihr_employee_portal_handler_emergency_contact_aggregated_address.inc
files[] = views/includes/civihr_employee_portal_argument_age_group.inc
files[] = views/includes/civihr_employee_portal_handler_absence_duration.inc
files[] = views/includes/civihr_employee_portal_handler_activity_type.inc
Expand Down
73 changes: 73 additions & 0 deletions civihr_employee_portal/civihr_employee_portal.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Drupal\civihr_employee_portal\Helpers\WebformHelper;

/**
* Create Report Pages and Report Age Settings menu links.
*/
Expand Down Expand Up @@ -165,6 +167,77 @@ function civihr_employee_portal_update_7008() {
}
}

/**
* Update My Details webform image description
*/
function civihr_employee_portal_update_7009() {
$nodes = node_load_multiple(NULL, ["title" => "My details - edit"]);

if (count($nodes) !== 1) {
return;
}

$myDetailsEditNode = current($nodes);

if (!isset($myDetailsEditNode->webform['components'])) {
return;
}

$components = $myDetailsEditNode->webform['components'];
$imageFieldName = 'Upload Image';
$description = 'The image should be at least 130 x 130 pixels, but 400 x 400 '
. 'pixels is the recommended size for the user image.';

foreach ($components as $component) {
if ($imageFieldName == $component['name']) {
$component['extra']['description'] = $description;
webform_component_update($component);
break;
}
}
}

/**
* Update My Details webform upload size
*/
function civihr_employee_portal_update_7010() {
$nodes = node_load_multiple(NULL, ["title" => "My details - edit"]);

if (count($nodes) !== 1) {
return;
}

$myDetailsWebform = current($nodes);

if (!isset($myDetailsWebform->webform['components'])) {
return;
}

$components = $myDetailsWebform->webform['components'];
$imageFieldName = 'Upload Image';

foreach ($components as $component) {
if ($imageFieldName == $component['name']) {
$component['extra']['filtering']['size'] = '10MB';
webform_component_update($component);
break;
}
}
}

/**
* Removes the "Emergency contact - edit" webform
*/
function civihr_employee_portal_update_7011() {
$node = WebformHelper::findOneByTitle('Emergency contact - edit');

if (!$node) {
return;
}

node_delete($node->nid);
}

/**
* Function to determine whether menu link exists or not.
*
Expand Down
Loading

0 comments on commit 9c55a5f

Please sign in to comment.