You are here

public function CrossdomainController::view in Crossdomain 8

1 string reference to 'CrossdomainController::view'
crossdomain.routing.yml in ./crossdomain.routing.yml
crossdomain.routing.yml

File

lib/Drupal/crossdomain/Controller/CrossdomainController.php, line 18
Contains \Drupal\crossdomain\Controller\CrossdomainController.

Class

CrossdomainController
Controller routines for path routes.

Namespace

Drupal\crossdomain\Controller

Code

public function view() {

  // @TODO: Need to get the values from the db and render

  //$domains = variable_get('crossdomain', array());
  $xml = "<?xml version=\"1.0\"?>\n\n<cross-domain-policy>\n";
  $domains = $this
    ->entityManager()
    ->getStorageController('crossdomain')
    ->loadMultiple();
  foreach ($domains as $domain) {
    $xml .= '  <allow-access-from domain="' . $domain
      ->label() . '" />' . "\n";
  }
  $xml .= '</cross-domain-policy>';
  $headers = array(
    'Content-Length' => strlen($xml),
    'Content-Type' => 'text/xml',
  );
  return new Response($xml, 200, $headers);
}