registerArgument('properties', 'array', 'All properties'); $this->registerArgument('name', 'string', 'Overrules name from properties'); $this->registerArgument('description', 'string', 'Overrules description from properties'); $this->registerArgument('city', 'string', 'Overrules city from properties'); $this->registerArgument('zip', 'string', 'Overrules zip from properties'); $this->registerArgument('street', 'string', 'Overrules street from properties'); $this->registerArgument('email', 'string', 'Overrules email from properties'); $this->registerArgument('image', 'string', 'Overrules image from properties'); $this->registerArgument('phone', 'string', 'Overrules phone from properties'); $this->registerArgument('url', 'string', 'Overrules url from properties'); } /** * @return string */ public function render(): string { return self::renderStatic( $this->arguments, $this->buildRenderChildrenClosure(), $this->renderingContext ); } /** * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return string */ public static function renderStatic( array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ) { $properties = self::getProperties($arguments); $content = json_encode($properties, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); return ''; } /** * @param array $arguments * @return array */ protected static function getProperties(array $arguments): array { $properties = [ '@context' => 'http://schema.org', '@type' => 'LocalBusiness', 'address' => [ '@type' => 'PostalAddress', 'addressLocality' => self::getProperty($arguments, 'city'), 'postalCode' => self::getProperty($arguments, 'zip'), 'streetAddress' => self::getProperty($arguments, 'street') ], 'name' => self::getProperty($arguments, 'name'), 'description' => self::getProperty($arguments, 'description'), 'telephone' => self::getProperty($arguments, 'phone'), 'email' => self::getProperty($arguments, 'email'), 'image' => self::getProperty($arguments, 'image'), 'url' => self::getProperty($arguments, 'url'), ]; return $properties; } }