protected function convertColor(Node $node, Document $document) { $color = $node->getAttribute('color'); if ($color) { $node->setAttribute('color', $document->getColorFromPalette($color)); } if ($node->hasAttribute('chart-colors')) { $colors = $node->getAttribute('chart-colors'); foreach ($colors as $key => $color) { $colors[$key] = $document->getColorFromPalette($color); } $node->setAttribute('chart-colors', $colors); } }
public function apply(Node $node) { $attributes = $this->getAll(); foreach ($attributes as $name => $value) { if (is_array($value)) { $node->mergeComplexAttributes($name, $value); } else { $node->setAttribute($name, $value); } } }