public static function getUsedProductsWithColor($usedProducts) { $products = $usedProducts; foreach($products AS $product) { $categories = get_the_category($product->ID); $parent_cat = null; foreach($categories as $category) { * @throws \ErrorException */ public function handleError($level, $message, $file = '', $line = 0, $context = []) { try { parent::handleError($level, $message, $file, $line, $context); } catch (Throwable $e) { if (! apply_filters('acorn/throw_error_exception', true, $e)) { return false; } public static function getUsedProductsWithColor($usedProducts) { $products = $usedProducts; foreach($products AS $product) { $categories = get_the_category($product->ID); $parent_cat = null; foreach($categories as $category) { { return [ 'all_references' => ReferencesArchive::getAllReferences(), 'featured_image_slideshow' => get_field('featured_image_slideshow'), 'references_title' => get_the_title(), 'references_used_products' => $this->getUsedProductsWithColor(get_field('used_products'), get_field('product_category')), 'references_cats' => $this->getReferencePrimaryCategoryWithColor( get_field('product_category') ), 'filter_categories' => CatFilter::getFilterCats(ReferencesArchive::getAllReferences()), ]; } * @return array */ protected function merge() { return array_merge( $this->with(), $this->view->getData(), $this->override() ); } public function compose(View $view) { $this->view = $view; $this->data = new Fluent($view->getData()); $view->with($this->merge()); } /** * Data to be merged and passed to the view before rendering. * // Once we have the class and method name, we can build the Closure to resolve // the instance out of the IoC container and call the method on it with the // given arguments that are passed to the Closure as the composer's data. return function () use ($class, $method) { return $this->container->make($class)->{$method}(...func_get_args()); }; } /** * Parse a class based composer name. return function ($event, $payload) use ($listener, $wildcard) { if ($wildcard) { return $listener($event, $payload); } return $listener(...array_values($payload)); }; } /** * Create a class based listener using the IoC container. } $responses = []; foreach ($this->getListeners($event) as $listener) { $response = $listener($event, $payload); // If a response is returned from the listener and event halting is enabled // we will just return this response, and not call the rest of the event // listeners. Otherwise we will add the response on the response list. if ($halt && ! is_null($response)) { * @param \Illuminate\Contracts\View\View $view * @return void */ public function callComposer(ViewContract $view) { $this->events->dispatch('composing: '.$view->name(), [$view]); } /** * Call the creator for a given view. * // We will keep track of the amount of views being rendered so we can flush // the section after the complete rendering operation is done. This will // clear out the sections for any separate views that may be rendered. $this->factory->incrementRender(); $this->factory->callComposer($this); $contents = $this->getContents(); // Once we've finished rendering the view, we'll decrement the render count // so that each sections get flushed out next time a view is created and * @throws \Throwable */ public function render(callable $callback = null) { try { $contents = $this->renderContents(); $response = isset($callback) ? $callback($this, $contents) : null; // Once we have the contents of the view, we will flush the sections if we are // done rendering all views so that there is nothing left hanging over when<body <?php body_class( ); ?>> <?php wp_body_open(); ?> <?php do_action('get_header'); ?> <div id="app"> <?php echo view(app('sage.view'), app('sage.data'))->render(); ?> </div> <?php do_action('get_footer'); ?> <?php wp_footer(); ?></body> * * @param string $template The path of the template to include. */ $template = apply_filters( 'template_include', $template ); if ( $template ) { include $template; } elseif ( current_user_can( 'switch_themes' ) ) { $theme = wp_get_theme(); if ( $theme->errors() ) { wp_die( $theme->errors() ); } // Set up the WordPress query. wp(); // Load the theme template. require_once ABSPATH . WPINC . '/template-loader.php';}/** * WordPress View Bootstrapper */define('WP_USE_THEMES', true);require __DIR__ . '/wp/wp-blog-header.php';|
ErrorException
|
|---|
ErrorException:
foreach() argument must be of type array|object, bool given
at /home/ubuntu/stage/web/themes/sage-murexin/app/View/Composers/Reference.php:59
at Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
(/var/www/stage/vendor/roots/acorn/src/Roots/Acorn/Bootstrap/HandleExceptions.php:54)
at Roots\Acorn\Bootstrap\HandleExceptions->handleError()
(/home/ubuntu/stage/web/themes/sage-murexin/app/View/Composers/Reference.php:59)
at App\View\Composers\Reference::getUsedProductsWithColor()
(/home/ubuntu/stage/web/themes/sage-murexin/app/View/Composers/Reference.php:29)
at App\View\Composers\Reference->with()
(/var/www/stage/vendor/roots/acorn/src/Roots/Acorn/View/Composer.php:70)
at Roots\Acorn\View\Composer->merge()
(/var/www/stage/vendor/roots/acorn/src/Roots/Acorn/View/Composer.php:59)
at Roots\Acorn\View\Composer->compose()
(/var/www/stage/vendor/illuminate/view/Concerns/ManagesEvents.php:124)
at Illuminate\View\Factory->Illuminate\View\Concerns\{closure}()
(/var/www/stage/vendor/illuminate/events/Dispatcher.php:404)
at Illuminate\Events\Dispatcher->Illuminate\Events\{closure}()
(/var/www/stage/vendor/illuminate/events/Dispatcher.php:249)
at Illuminate\Events\Dispatcher->dispatch()
(/var/www/stage/vendor/illuminate/view/Concerns/ManagesEvents.php:177)
at Illuminate\View\Factory->callComposer()
(/var/www/stage/vendor/illuminate/view/View.php:120)
at Illuminate\View\View->renderContents()
(/var/www/stage/vendor/illuminate/view/View.php:91)
at Illuminate\View\View->render()
(/home/ubuntu/stage/web/themes/sage-murexin/index.php:32)
at include('/home/ubuntu/stage/web/themes/sage-murexin/index.php')
(/var/www/stage/web/wp/wp-includes/template-loader.php:106)
at require_once('/var/www/stage/web/wp/wp-includes/template-loader.php')
(/var/www/stage/web/wp/wp-blog-header.php:19)
at require('/var/www/stage/web/wp/wp-blog-header.php')
(/var/www/stage/web/index.php:11)
|