You are here

function commons_like_strongarm_alter in Drupal Commons 7.3

Implements hook_strongarm_alter().

File

modules/commons/commons_like/commons_like.module, line 12

Code

function commons_like_strongarm_alter(&$items) {

  // Expose the Post content type for 'liking' via the Commons_like module
  // by altering the configuration for the Rate.module widget that it provides.
  if (!empty($items['rate_widgets']->value)) {
    foreach ($items['rate_widgets']->value as $key => $widget) {
      if ($widget->name == 'commons_like') {
        $commons_entity_integrations = commons_entity_integration_info();
        if (!empty($commons_entity_integrations['node'])) {
          foreach ($commons_entity_integrations['node'] as $bundle => $options) {
            if (!isset($options['exclude_rate']) || $options['exclude_rate'] != TRUE) {
              $items['rate_widgets']->value[$key]->node_types[] = $bundle;
            }
            if (!isset($options['exclude_rate_comments']) || $options['exclude_rate_comments'] != TRUE) {
              $items['rate_widgets']->value[$key]->comment_types[] = $bundle;
            }
          }
        }
      }
    }
  }
}