post = $post; $this->post_array = $this->create_array(); } public function create_array() { $self = $this; $post_content = $this->post->post_content; // Remove HTML block wrappers in UX Builder. // They will be added by ArrayToString.php when saved. $post_content = preg_replace( '//', '', $post_content ); $this->post_array = ux_builder( 'to-array' )->transform( "[_root]{$post_content}[/_root]" ); ux_builder_content_array_walk( $this->post_array, function ( &$item ) use ( $self ) { $item['options'] = $self->get_options( $item['tag'], $item['options'] ); }); return array_shift( $this->post_array ); } /** * Gets the generated post array. * * @return array */ public function get_array() { return $this->post_array; } /** * Get options for an element. * * @param string $tag * @param array $values * @return array */ public function get_options( $tag, $values ) { $shortcode = ux_builder_shortcodes()->get( $tag ); $options = new ElementOptions( $shortcode['options'] ); return $options->set_values( $values )->camelcase()->get_values(); } }