/** * Redirect the user to an object's location in Alfresco * * This should render an HTML page that redirects the user to * the object's URL in alfresco share. * * @param string $objectId */ function _cmisro_proxy($objectId) { $o = _cmisro_getObject($objectId); $url = _cmisro_getShareUrl($o['nodeRef']); header("Location: {$url}"); exit; }
/** * @implements hook_field_formatter_view() * @see https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_formatter_view/7 */ function cmisro_field_formatter_view($entity_type, $entity, $field, $instance, $lang, $items, $display) { $element = []; switch ($display['type']) { case 'cmisro_reference_formatter': foreach ($items as $delta => $item) { try { $element[$delta] = ['#markup' => theme('cmisro_reference', ['reference' => $item['reference']])]; } catch (\Exception $e) { // The item references should have already been checked when the user // originally saved them in the content. // If there's a problem with one of them at display-time, // we can just ignore it. } } break; /** * Render a link to the custom route we've declared * @see cmisro_menu() */ /** * Render a link to the custom route we've declared * @see cmisro_menu() */ case 'cmisro_directorylisting_formatter': foreach ($items as $i => $item) { try { $o = _cmisro_getObject($item['reference']); $uri = _cmisro_folder_uri($entity->nid, $o['id']); $attr = current_path() === $uri ? ['attributes' => ['class' => ['current']]] : []; $element[$i] = ['#markup' => l($o['title'], $uri, $attr)]; } catch (\Exception $e) { // The item references should have already been checked when the user // originally saved them in the content. // If there's a problem with one of them at display-time, // we can just ignore it. } } break; } return $element; }