doNegotiate example


  public function negotiate(string $component_id, array $all_definitions): ?string {
    $cache_key = $this->generateCacheKey($component_id);
    $cached_data = $this->cache[$cache_key] ?? NULL;
    if (isset($cached_data)) {
      return $cached_data;
    }
    $negotiated = $this->doNegotiate($component_id$all_definitions);
    $this->cache[$cache_key] = $negotiated;
    return $negotiated;
  }

  /** * Negotiates the active component for the current request. * * @param string $component_id * The requested component id. Ex: 'my-button', 'my-button--primary', * 'sdc_example:my-button--primary', ... * @param array[] $all_definitions * All the plugin definitions for components keyed by plugin ID. * * @return string|null * The negotiated plugin ID or null if no negotiation was successful. */
Home | Imprint | This part of the site doesn't use cookies.