<?php

namespace Dev4Press\Plugin\BreadcrumbsPress\Extend;

use Dev4Press\Plugin\BreadcrumbsPress\Basic\Loader;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

abstract class Theme {
	protected $theme;
	protected $name;
	protected $priority = 10;
	protected $wrapper_class = '';
	protected $args = array();
	protected $actions = array();
	protected $priorities = array();

	public function __construct() {
		$this->name = apply_filters( 'breadcrumbspress_theme_action_name_' . $this->theme, Loader::instance()->action() );

		if ( ! empty( $this->actions ) && ! in_array( $this->name, $this->actions ) ) {
			$this->name = $this->actions[0];
		}

		$this->load();
	}

	public function breadcrumbs() {
		$args = apply_filters( 'breadcrumbspress_theme_arguments_' . $this->theme, $this->args );

		echo Loader::instance()->render( $this->theme, $this->wrapper_class, $args );
	}

	abstract protected function load();
}
