Set default labels

Create an labels array and implement default singular and plural labels
@return $this
2829
protected function setDefaultLabels()
    {
        $this->labels = [
            'name'                  => _x($this->many, 'Post type general name', $this->i18n),
            'singular_name'         => _x($this->one, 'Post type singular name', $this->i18n),
            'menu_name'             => _x($this->many, 'Admin Menu text', $this->i18n),
            'name_admin_bar'        => _x($this->one, 'Add New on Toolbar', $this->i18n),
            'add_new_item'          => __('Add New ' . $this->one, $this->i18n),
            'edit_item'             => __('Edit ' . $this->one, $this->i18n),
            'new_item'              => __('New ' . $this->one, $this->i18n),
            'view_item'             => __('View ' . $this->one, $this->i18n),
            'view_items'            => __('View ' . $this->many, $this->i18n),
            'search_items'          => __('Search ' . $this->many, $this->i18n),
            'not_found'             => __('No ' . strtolower($this->many) . ' found.', $this->i18n),
            'not_found_in_trash'    => __('No ' . strtolower($this->many) . ' found in Trash.', $this->i18n),
            'parent_item_colon'     => __('Parent ' . $this->many . ':', $this->i18n),
            'all_items'             => __('All ' . $this->many, $this->i18n),
            'archives'              => __($this->one . ' Archives', $this->i18n),
            'attributes'            => __($this->one . ' Attributes', $this->i18n),
            'insert_into_item'      => __('Insert into ' . strtolower($this->one), $this->i18n),
            'uploaded_to_this_item' => __('Uploaded to this ' . strtolower($this->one), $this->i18n),
            'filter_items_list'     => __('Filter ' . strtolower($this->many) . ' list', $this->i18n),
            'items_list_navigation' => __($this->many . ' list navigation', $this->i18n),
            'items_list'            => __($this->many . ' list', $this->i18n)
        ];

        return $this;
    }
1129386
protected function setLabels()
    {
        if ($this->data['labels.overrides']) {
            $this->labels = array_replace($this->labels, $this->data['labels.overrides']);
        }
    }
421037
private function setLabels()
    {
        $this->labels = [
            'name'               => ucwords($this->plural),
            'singular_name'      => ucwords($this->singular),
            'menu_name'          => ucwords($this->plural),
            'name_admin_bar'     => ucwords($this->singular),
            'add_new'            => 'Add New',
            'add_new_item'       => 'Add New ' . ucwords($this->singular),
            'new_item'           => 'New ' . $this->singular,
            'edit_item'          => 'Edit ' . $this->singular . ' details',
            'view_item'          => 'View ' . $this->singular,
            'all_items'          => 'All ' . $this->plural,
            'search_items'       => 'Search ' . $this->plural,
            'parent_item_colon'  => 'Parent ' . $this->plural . ':',
            'not_found'          => 'No ' . $this->plural . ' found.',
            'not_found_in_trash' => 'No ' . $this->plural . ' found in Trash.'
        ];
    }
463224
private function set_default_args() {
		$this->set_args(array(
			// The array of labels to use in the UI for this post type.
			'labels' => $this->labels,
			// Array of supported fields ( title, editor, thumbnail, etc ).
			'supports' => $this->supports,
			// We use the query var 'store' as opposed to the post type 'acf-store'.
			'query_var' => strtolower( $this->singular ),
			// Triggers the handling of re-writes for this post-type.
			'rewrite' => $this->rewrite,
		));
	}
1171871
protected function setDefaults()
	{
		$this->file = $this->protect(function($filePath)
		{
			return new SplFileInfo($filePath);
		});
		
		$this->tempFile = $this->protect(function($contents, $ext)
		{
			$file = new TempFile('GearsPdf', $ext);
			
			$file->setContents($contents);
			
			return $file;
		});
	}
486001
protected function getLabels()
    {
        $pluralName = $this->getPluralName();
        $singularName = $this->getSingularName();

        return array(
            'name' => _x($pluralName, strtolower($pluralName)),
            'singular_name' => _x($singularName, strtolower($singularName)),
            'search_items' => __('Search ' . $pluralName),
            'all_items' => __('All ' . $pluralName),
            'parent_item' => __('Parent ' . $singularName),
            'parent_item_colon' => __('Parent ' . $singularName . ":"),
            'edit_item' => __('Edit ' . $singularName),
            'update_item' => __('Update ' . $singularName),
            'add_new_item' => __('Add New ' . $singularName),
            'new_item_name' => __('New ' . $singularName),
            'menu_name' => __($pluralName)
        );
    }
1154897
public function labels($labels = null)
    {
        if ($labels === null)
        {
            return $this->_labels;
        }

        $this->_labels = $labels;
        return $this;
    }
899317
public function setLabel($label) : self
    {
        $index = $this->getIndex($this->label);

        if (!$label instanceof Label && !$label instanceof HtmlElement) {
            $label = new Label($label);
        }

        $this->label = $label;

        if (is_null($index)) {
            array_unshift($this->elements, $label);
        } else {
            $this->elements[$index] = $label;
        }

        return $this;
    }
1224097
protected function addDefaultLabel() {
        $label = $this->getLabel();
        $font = $this->font;
        if ($label !== null && $label !== '' && $font !== null && $this->defaultLabel !== null) {
            $this->defaultLabel->setText($label);
            $this->defaultLabel->setFont($font);
            $this->addLabel($this->defaultLabel);
        }
    }
162578
public function setAttachmentDefaults($defaults)
    {
        if ($this->attachmentDefaults != ($defaults = (array) $defaults)) {
            $this->attachmentDefaults = $defaults;

            $this->setAttachments($this->attachments);
        }

        return $this;
    }
216923
public function loadDefaultDecorators()
    {
        if ($this->loadDefaultDecoratorsIsDisabled()) {
            return $this;
        }

        $htmlTagOptions = array(
                'tag' => 'div',
                'id'  => array('callback' => array(get_class($this), 'resolveElementId')),
        );
        $labelOptions = array();
        if (\MUtil_Bootstrap::enabled()) {
            $htmlTagOptions['class'] = 'element-container';
        }


        $decorators = $this->getDecorators();
        if (empty($decorators)) {
            $this->addDecorator('ViewHelper')
                 ->addDecorator('Errors')
                 ->addDecorator('Description', array('tag' => 'p', 'class' => 'help-block'))
                 ->addDecorator('HtmlTag', $htmlTagOptions)
                 ->addDecorator('Label')
                 ->addDecorator('BootstrapRow');
        }
        return $this;
    }
585951
protected function setDefaults()
	{
		$this->zip = function()
		{
			return new ZipArchive;
		};

		$this->xml = $this->protect(function($xml)
		{
			return SimpleXMLElement::fixSplitTags($xml);
		});

		$this->converter = function()
		{
			return new LibreOffice();
		};
	}
438131
protected function setDefaultClasses(array $options = [])
    {
        $defaults = parent::setDefaultClasses($options);
        $choice_type = $this->determineChoiceField();

        $wrapper_class = $this->formHelper->getConfig('defaults.' . $this->type . '.' . $choice_type . '_wrapper_class', '');
        if ($wrapper_class) {
            $defaults['wrapper']['class'] = (isset($defaults['wrapper']['class']) ? $defaults['wrapper']['class'] . ' ' : '') . $wrapper_class;
        }

        $choice_wrapper_class = $this->formHelper->getConfig('defaults.' . $this->type . '.choice_options.wrapper_class', '');
        $choice_label_class = $this->formHelper->getConfig('defaults.' . $this->type . '.choice_options.label_class', '');
        $choice_field_class = $this->formHelper->getConfig('defaults.' . $this->type . '.choice_options.field_class', '');

        if ($choice_wrapper_class) {
            $defaults['choice_options']['wrapper']['class'] = $choice_wrapper_class;
        }
        if ($choice_label_class) {
            $defaults['choice_options']['label_attr']['class'] = $choice_label_class;
        }
        if ($choice_field_class) {
            $defaults['choice_options']['attr']['class'] = $choice_field_class;
        }

        return $defaults;
    }
533420
public function setLabel($label)
    {
        if (in_array(
            $label,
            $this->validLabels
        )) {
            $this->label = $label;
        }

        return $this;
    }
28130
public function getDefaultLabel()
    {
        $oDefault = $this->getDefault();
        return empty($oDefault->label) ? false : $oDefault->label;
    }
35052
public function setLabels($labels) 
	{
		if(is_array($labels)) {
			$this->labels = $labels;
			return $this;
		}
		
		$args = func_get_args();
		$this->labels[$args[0]] = $args[1];
		
		return $this;
	}
738722
public function defaultLabels($plural, $singular)
    {
        return [
            'name' => $plural,
            'singular_name' => $singular,
            'menu_name' => $plural,
            'all_items' => $plural,

            'add_new' => Translate::t('posttype.defaults.labels.add_new'),
            'add_new_item' => Translate::t('posttype.defaults.labels.add_new_item'),
            'edit' => Translate::t('posttype.defaults.labels.edit'),
            'edit_item' => Translate::t('posttype.defaults.labels.edit_item'),
            'new_item' => Translate::t('posttype.defaults.labels.new_item'),

            'not_found' => Translate::t('posttype.defaults.labels.not_found'),
            'not_found_in_trash' => Translate::t('posttype.defaults.labels.not_found_in_trash'),
            'parent_item_colon' => Translate::t('posttype.defaults.labels.parent_item_colon'),
            'search_items' => Translate::t('posttype.defaults.labels.search_items'),

            'view' => Translate::t('posttype.defaults.labels.view'),
            'view_item' => Translate::t('posttype.defaults.labels.view_item'),
        ];
    }