sfWebResponse::getJavascripts PHP Method

getJavascripts() public method

By default, the position is sfWebResponse::ALL, and the method returns all javascripts ordered by position.
public getJavascripts ( string $position = self::ALL ) : array
$position string The position
return array An associative array of javascript files as keys and options as values
    public function getJavascripts($position = self::ALL)
    {
        if (self::ALL === $position) {
            $javascripts = array();
            foreach ($this->getPositions() as $position) {
                foreach ($this->javascripts[$position] as $file => $options) {
                    $javascripts[$file] = $options;
                }
            }
            return $javascripts;
        } else {
            if (self::RAW === $position) {
                return $this->javascripts;
            }
        }
        $this->validatePosition($position);
        return $this->javascripts[$position];
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Merges all properties from a given sfWebResponse object to the current one.
  *
  * @param sfWebResponse $response  An sfWebResponse instance
  */
 public function merge(sfWebResponse $response)
 {
     foreach ($this->getPositions() as $position) {
         $this->javascripts[$position] = array_merge($this->getJavascripts($position), $response->getJavascripts($position));
         $this->stylesheets[$position] = array_merge($this->getStylesheets($position), $response->getStylesheets($position));
     }
     $this->slots = array_merge($this->getSlots(), $response->getSlots());
 }
All Usage Examples Of sfWebResponse::getJavascripts