Yoast\WP\SEO\Dashboard\Domain\Content_Types

Content_Type{}Yoast 1.0

This class describes a Content Type.

Хуков нет.

Использование

$Content_Type = new Content_Type();
// use class methods

Методы

  1. public __construct( string $name, string $label, ?Taxonomy $taxonomy = null )
  2. public get_label()
  3. public get_name()
  4. public get_taxonomy()
  5. public set_taxonomy( ?Taxonomy $taxonomy )

Код Content_Type{} Yoast 24.3

class Content_Type {

	/**
	 * The name of the content type.
	 *
	 * @var string
	 */
	private $name;

	/**
	 * The label of the content type.
	 *
	 * @var string
	 */
	private $label;

	/**
	 * The taxonomy that filters the content type.
	 *
	 * @var Taxonomy
	 */
	private $taxonomy;

	/**
	 * The constructor.
	 *
	 * @param string        $name     The name of the content type.
	 * @param string        $label    The label of the content type.
	 * @param Taxonomy|null $taxonomy The taxonomy that filters the content type.
	 */
	public function __construct( string $name, string $label, ?Taxonomy $taxonomy = null ) {
		$this->name     = $name;
		$this->label    = $label;
		$this->taxonomy = $taxonomy;
	}

	/**
	 * Gets name of the content type.
	 *
	 * @return string The name of the content type.
	 */
	public function get_name(): string {
		return $this->name;
	}

	/**
	 * Gets label of the content type.
	 *
	 * @return string The label of the content type.
	 */
	public function get_label(): string {
		return $this->label;
	}

	/**
	 * Gets the taxonomy that filters the content type.
	 *
	 * @return Taxonomy|null The taxonomy that filters the content type.
	 */
	public function get_taxonomy(): ?Taxonomy {
		return $this->taxonomy;
	}

	/**
	 * Sets the taxonomy that filters the content type.
	 *
	 * @param Taxonomy|null $taxonomy The taxonomy that filters the content type.
	 *
	 * @return void
	 */
	public function set_taxonomy( ?Taxonomy $taxonomy ): void {
		$this->taxonomy = $taxonomy;
	}
}