Skip to content

Commit

Permalink
committing old changes not previously pushed to git hub. Changes incl…
Browse files Browse the repository at this point in the history
…ude changes to hidden fields, php syntax, and calling check_plain on titles being passed to cablecast
  • Loading branch information
Mark Libkuman committed Dec 15, 2019
1 parent 1efec2a commit 6ecfd7f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions cm_cablecast.module
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ function cm_cablecast_form_alter(&$form, &$form_state, $form_id) {
switch($form_id) {
case 'cm_project_node_form':
if(!user_access('administer cablecast')) {
$form['field_cablecast_project_id']['#type'] = 'hidden';
$form['field_cablecast_project_id']['#access'] = FALSE;
}
break;
case 'cm_show_node_form':
if(!user_access('administer cablecast')) {
$form['field_cablecast_show_id']['#type'] = 'hidden';
$form['field_cablecast_show_id']['#access'] = FALSE;
}
break;
case 'user_profile_form':
if(!user_access('administer cablecast')) {
$form['field_cablecast_producer_id']['#type'] = 'hidden';
$form['field_cablecast_producer_id']['#access'] = FALSE;
}
break;
}
Expand Down Expand Up @@ -845,13 +845,13 @@ function _cm_cablecast_is_channel_changed($entity_wrapper, $project, $mapping) {
function _cm_cablecast_is_cablecast_object_changed($entity_wrapper, $cablecast_object, $mapping) {
foreach ($mapping['fields'] as $cablecast_field => $field_settings) {
if ($field_settings['drupal_field']) {
$field_info = $entity_wrapper->$field_settings['drupal_field']->info();
$field_info = $entity_wrapper->{$field_settings['drupal_field']}->info();
if (isset($field_info['property info'])) {
// a multi-valued field.
$value = $entity_wrapper->$field_settings['drupal_field']->value->value();
$value = $entity_wrapper->{$field_settings['drupal_field']}->value->value();
} else {
// a single-valued field
$value = $entity_wrapper->$field_settings['drupal_field']->raw();
$value = $entity_wrapper->{$field_settings['drupal_field']}->raw();
}
if ($value != $cablecast_object->$cablecast_field ) {
return true;
Expand Down
12 changes: 6 additions & 6 deletions modules/cablecast_api/cablecast_api.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function cablecast_api_add_project($node) {
// setup data array for SOAP call
$data = array(
'LocationID' => 1,
'Name' => check_plain($node->title),
'Name' => $node->title,
'Description' => '',
'ProducerID' => $cc_producer_id,
'Podcast' => FALSE,
Expand Down Expand Up @@ -298,7 +298,7 @@ function cablecast_api_update_project($node) {
// setup data array for SOAP call
$data = array(
'ProjectID' => $cc_project_id,
'Name' => check_plain($node->title),
'Name' => $node->title,
'Description' => '',
'ProducerID' => $cc_producer_id,
'Podcast' => FALSE,
Expand Down Expand Up @@ -495,8 +495,8 @@ function cablecast_api_add_show($node) {
$data = array(
'LocalID' => "Added by API",
'LocationID' => 1,
'Title' => check_plain($node->title),
'CGTitle' => check_plain($node->title),
'Title' => $node->title,
'CGTitle' => $node->title,
'ProjectID' => $cc_project_id,
// TODO: may vary based on project type or other criteria
'CGExempt' => FALSE,
Expand Down Expand Up @@ -592,8 +592,8 @@ function cablecast_api_update_show($node) {
'ShowID' => $cc_show_id,
'LocalID' => "Added by API",
'LocationID' => 1,
'Title' => check_plain($node->title),
'CGTitle' => check_plain($node->title),
'Title' => $node->title,
'CGTitle' => $node->title,
'ProjectID' => $cc_project_id,
// TODO: may vary based on project type or other criteria
'CGExempt' => FALSE,
Expand Down
10 changes: 5 additions & 5 deletions modules/cablecast_api/cablecast_api.module
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ function _cablecast_api_sync_cablecast_object($cablecast_object, $mapping) {
$entity_info = entity_get_info($mapping['entity_type']);

//See if we already have the entity in drupal
$eid = _cablecast_api_get_drupal_eid($cablecast_object->$mapping['cablecast_id'], $mapping, $entity_info['entity keys']['id']);
$eid = _cablecast_api_get_drupal_eid($cablecast_object->{$mapping['cablecast_id']}, $mapping, $entity_info['entity keys']['id']);

if($eid == false) {
if ($mapping['entity_type'] == 'taxonomy_term') {
Expand Down Expand Up @@ -341,7 +341,7 @@ function _cablecast_api_sync_cablecast_object($cablecast_object, $mapping) {
if ($eid == false || _cablecast_api_is_cablecast_object_changed($entity_wrapper, $cablecast_object, $mapping)) {
foreach ($mapping['fields'] as $cablecast_field => $field_settings) {
if ($field_settings['drupal_field']) {
$field_wrapper = $entity_wrapper->$field_settings['drupal_field'];
$field_wrapper = $entity_wrapper->{$field_settings['drupal_field']};
if ($entity_wrapper->type() == 'taxonomy_term') {
$field_wrapper->set($cablecast_object->$cablecast_field);
} else {
Expand Down Expand Up @@ -502,13 +502,13 @@ function _cablecast_api_is_channel_changed($entity_wrapper, $project, $mapping)
function _cablecast_api_is_cablecast_object_changed($entity_wrapper, $cablecast_object, $mapping) {
foreach ($mapping['fields'] as $cablecast_field => $field_settings) {
if ($field_settings['drupal_field']) {
$field_info = $entity_wrapper->$field_settings['drupal_field']->info();
$field_info = $entity_wrapper->{$field_settings['drupal_field']}->info();
if (isset($field_info['property info'])) {
// a multi-valued field.
$value = $entity_wrapper->$field_settings['drupal_field']->value->value();
$value = $entity_wrapper->{$field_settings['drupal_field']}->value->value();
} else {
// a single-valued field
$value = $entity_wrapper->$field_settings['drupal_field']->raw();
$value = $entity_wrapper->{$field_settings['drupal_field']}->raw();
}
if ($value != $cablecast_object->$cablecast_field ) {
return true;
Expand Down

0 comments on commit 6ecfd7f

Please sign in to comment.