You are here

function space_type_purl::activate in Spaces 6.3

Same name and namespace in other branches
  1. 7.3 plugins/space_type_purl.inc \space_type_purl::activate()
  2. 7 plugins/space_type_purl.inc \space_type_purl::activate()

Override of activate(). Ensure that the PURL modifier is present when the space is active.

Overrides space::activate

1 call to space_type_purl::activate()
space_og::activate in spaces_og/plugins/space_og.inc
Override of activate().
1 method overrides space_type_purl::activate()
space_og::activate in spaces_og/plugins/space_og.inc
Override of activate().

File

plugins/space_type_purl.inc, line 34

Class

space_type_purl
Common functionality for space types that use a PURL modifier to trigger their activation. Examples: space_og, space_taxonomy.

Code

function activate() {
  if (!$this
    ->verify_purl()) {
    $this
      ->purge_request_destination();

    // @TODO: This will drop other PURL providers. Probably not the desired behavior!
    purl_goto($_GET['q'], array(
      'query' => drupal_query_string_encode($_GET, array(
        'q',
      )),
      'purl' => array(
        'provider' => "spaces_{$this->type}",
        'id' => $this->id,
      ),
    ));
  }

  // Activate the space before checking for excluded paths. This prevents
  // certain corner case badness, e.g. a stale $_GET['q'] set for the site
  // space triggering an excluded path check.
  $activated = parent::activate();
  $paths = implode("\n", $this
    ->excluded_paths());
  if (drupal_match_path($_GET['q'], $paths)) {
    $this
      ->deactivate();
    return FALSE;
  }
  return TRUE;
}