Carbon_Fields\Field\Relationship_Field::get_title_by_type PHP Метод

get_title_by_type() публичный Метод

Can be overriden or extended by the carbon_relationship_title filter.
public get_title_by_type ( integer $id, string $type, string $subtype = '' ) : string
$id integer The database ID of the item.
$type string Item type (post, term, user, comment, or a custom one).
$subtype string The subtype - "page", "post", "category", etc.
Результат string $title The title of the item.
    public function get_title_by_type($id, $type, $subtype = '')
    {
        $title = get_the_title($id);
        if (!$title) {
            $title = '(no title) - ID: ' . $id;
        }
        /**
         * Filter the title of the relationship item.
         *
         * @param string $title   The unfiltered item title.
         * @param string $name    Name of the relationship field.
         * @param int    $id      The database ID of the item.
         * @param string $type    Item type (post, term, user, comment, or a custom one).
         * @param string $subtype Subtype - "page", "post", "category", etc.
         */
        return apply_filters('carbon_relationship_title', $title, $this->get_name(), $id, $type, $subtype);
    }