public get_labels ( ) : array | ||
Résultat | array |
public function get_labels()
{
if (!$this->fill_labels) {
return $this->labels;
}
return array_merge($this->labels, ['add_new_item' => sprintf('%s %s', __('Add New', 'papi'), $this->name), 'edit_item' => sprintf('%s %s', __('Edit', 'papi'), $this->name), 'view_item' => sprintf('%s %s', __('View', 'papi'), $this->name)]);
}
/** * Override labels with labels from the page type. * * @param Papi_Page_Type $page_type */ private function override_labels(Papi_Page_Type $page_type) { global $wp_post_types; $post_type = papi_get_post_type(); if (empty($post_type) || !isset($wp_post_types[$post_type])) { return; } foreach ($page_type->get_labels() as $key => $value) { if (!isset($wp_post_types[$post_type]->labels->{$key}) || empty($value)) { continue; } $wp_post_types[$post_type]->labels->{$key} = $value; } }