private function processContent(&$gadget, $content) { $attributes = $content->attributes(); if (empty($attributes['type'])) { throw new SpecParserException("No content type specified!"); } $view = isset($attributes['view']) ? trim($attributes['view']) : ''; $views = explode(',', $view); $html = (string) $content; // no trim here since empty lines can have structural meaning, so typecast to string instead foreach ($views as $view) { if (empty($view)) { $view = DEFAULT_VIEW; } $viewSpec = new ViewSpec($view, $content); if (!isset($gadget->views[$view])) { $viewSpec->content = $html; $gadget->views[$view] = $viewSpec; } else { if ($gadget->views[$view]->getName() == $viewSpec->getName() && $viewSpec->getType() != $gadget->views[$view]->getType()) { throw new SpecParserException("You may not mix content " . " types in the same view."); } $gadget->views[$view]->addContent($html); } } }
private function processContent(&$gadget, $content, $views) { $html = (string) $content; // no trim here since empty lines can have structural meaning, so typecast to string instead foreach ($views as $view) { $viewSpec = new ViewSpec($view, $content); if (!isset($gadget->views[$view])) { $viewSpec->content = $html; $gadget->views[$view] = $viewSpec; } else { if ($gadget->views[$view]->getName() == $viewSpec->getName() && $viewSpec->getType() != $gadget->views[$view]->getType()) { throw new SpecParserException("You may not mix content " . " types in the same view."); } $gadget->views[$view]->addContent($html); } } }