Set metabox translations strings.

@param MetaboxInterface $metabox

@return $this
342068
protected function setMetaboxTranslations(MetaboxInterface $metabox)
    {
        if (! function_exists('__')) {
            return $this;
        }

        $metabox->addTranslation('done', __('Saved', Application::TEXTDOMAIN));
        $metabox->addTranslation('error', __('Saved with errors', Application::TEXTDOMAIN));
        $metabox->addTranslation('saving', __('Saving', Application::TEXTDOMAIN));
        $metabox->addTranslation('submit', sprintf('%s %s', __('Save', Application::TEXTDOMAIN), $metabox->getTitle()));

        return $this;
    }
122564
public function setTranslations(ArrayCollection $translations)
    {
        foreach ($translations as $translation) {
            $translation->setObject($this);
        }

        $this->translations = $translations;
    }
578742
public function dispatch(
        MetaboxModel $metabox,
        MetaboxFactory $factory,
        HookFactory $hook
    ) {
        $this->metabox = $metabox;
        $this->factory = $factory;
        $this->hook = $hook;
    }
820717
public function saveFields(MetaboxInterface $metabox, Request $request): MetaboxInterface
    {
        $post_id = $request->query('post_id');
        $data = $this->getMetaboxData(collect($request->get('fields')));
        $fields = $metabox->repository()->all();

        /** @var $validator Validator */
        $validator = $this->factory->make(
            $data,
            $this->getMetaboxRules($fields),
            $this->getMetaboxMessages($fields),
            $this->getMetaboxPlaceholders($fields)
        );

        $validatedData = $validator->valid();

        foreach ($fields as $field) {
            /** @var FieldTypeInterface|CanHandleMetabox|BaseType $field */
            $field->setErrorMessageBag($validator->errors());

            if (method_exists($field, 'metaboxSave')) {
                $value = isset($validatedData[$field->getName()]) ? $validatedData[$field->getName()] : null;
                $field->metaboxSave($value, $post_id);
            } else {
                throw new MetaboxException(
                    'Unable to save ['.$field->getName().']. The [metaboxSave] method is missing.'
                );
            }
        }

        return $metabox;
    }
392926
public function add($field, SectionInterface $section = null): MetaboxInterface
    {
        if ($field instanceof SectionInterface) {
            $section = $field;

            if ($section->hasItems()) {
                foreach ($section->getItems() as $item) {
                    /** @var FieldTypeInterface $item */
                    $item->setOptions([
                        'group' => $section->getId()
                    ]);

                    $this->add($item, $section);
                }
            }

            return $this;
        }

        $field->setLocale($this->getLocale());
        $field->setPrefix($this->getPrefix());

        if (is_null($section)) {
            if ($this->repository()->hasGroup($field->getOption('group'))) {
                $section = $this->repository()->getGroup($field->getOption('group'));
            } else {
                $section = new Section($field->getOption('group'));
            }
            $section->addItem($field);
        }

        $this->repository()->addField($field, $section);

        return $this;
    }
1182974
protected function setClass($type, &$meta)
    {
        switch ($type) {
            case ValidForm::VFORM_STRING:
                $this->setFieldMeta("class", "vf__string");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_WORD:
                $this->setFieldMeta("class", "vf__word");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_EMAIL:
                $this->setFieldMeta("class", "vf__email");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_URL:
            case ValidForm::VFORM_SIMPLEURL:
                $this->setFieldMeta("class", "vf__url");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_CUSTOM:
                $this->setFieldMeta("class", "vf__custom");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_CURRENCY:
                $this->setFieldMeta("class", "vf__currency");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_DATE:
                $this->setFieldMeta("class", "vf__date");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_NUMERIC:
                $this->setFieldMeta("class", "vf__numeric");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_INTEGER:
                $this->setFieldMeta("class", "vf__integer");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_PASSWORD:
                $this->setFieldMeta("class", "vf__password");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_HTML:
                $this->setFieldMeta("class", "vf__html");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_CUSTOM_TEXT:
                $this->setFieldMeta("class", "vf__custom");
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_TEXT:
                $this->setFieldMeta("class", "vf__text");
                break;
            case ValidForm::VFORM_FILE:
                $this->setFieldMeta("class", "vf__file");
                break;
            case ValidForm::VFORM_BOOLEAN:
                $this->setFieldMeta("class", "vf__checkbox");
                break;
            case ValidForm::VFORM_RADIO_LIST:
            case ValidForm::VFORM_CHECK_LIST:
                $this->setFieldMeta("class", "vf__list");
                break;
            case ValidForm::VFORM_SELECT_LIST:
                if (! isset($meta["multiple"])) {
                    $this->setFieldMeta("class", "vf__one");
                } else {
                    $this->setFieldMeta("class", "vf__multiple");
                }

                $this->setFieldMeta("class", "vf__select");
                break;
        }
    }
50267
public function setTranslator($translator = null)
    {
        if (!$translator instanceof Translator && !$translator instanceof \Zend\I18n\Translator\TranslatorInterface) {
            throw new \InvalidArgumentException('Translator must be an instanceof "Zend\I18n\Translator\Translator" or "Zend\I18n\Translator\TranslatorInterface"');
        }

        $this->translator = $translator;
    }
763899
public function setMetadataBag(MetadataBag $metaBag = null)
    {
        if ($this->innerSessionStorage instanceof NativeSessionStorage) {
            $this->innerSessionStorage->setMetadataBag($metaBag);
        }
    }
1313986
public function add_metaboxes() {

		// metabox defaults
		$defaults = [
			'context'  => 'advanced',
			'priority' => 'default',
		];

		$metabox = array_merge( $defaults, $this->struct );

		add_meta_box(
			'metabox-' . $this->id(),
			$metabox['name'],
			[ $this, 'create_metabox' ],
			$metabox['screen'],
			$metabox['context'],
			$metabox['priority']
		);

	}
421932
public function resolve(MetaSetField $field)
    {
        $type = $field->getType();

        if ($type === 'select') {
            $options = [];
            foreach (explode(',', $field->getOptions()) as $value) {
                $option = [$value];

                $translationIdentifier = $value;
                if ($this->useTitlePrefix) {
                    $translationIdentifier = $field->getMetaSet()->getName().'.'.$translationIdentifier;
                }

                foreach ($this->languages as $language) {
                    $option[] = $this->translator->trans($translationIdentifier, [], $this->domain, $language);
                }

                $options[] = $option;
            }

            return $options;
        } elseif ($type === 'suggest') {
            $dataSourceId = $field->getOptions();
            $options = [
                'source_id' => $dataSourceId,
            ];

            return $options;
        }

        return null;
    }
411244
public function create_metabox( $post ) {

		$this->post = $post;
		$data       = get_post_meta( $post->ID, $this->slug, true );
		if ( empty( $data ) ) {
			$data = [
				$this->slug => [],
			];
		}
		$this->set_data( $data );
		echo $this->render();

	}
1233985
public function setCombobox($box)
    {
        $this->_combobox = $box;
        $this->_combobox->setFormName($this->fields->getFormName());
        return $this;
    }
345335
public function setMetaTitle($metaTitle, $locale = null)
    {
        $this->translate($locale, false)->setMetaTitle($metaTitle);
        $this->mergeNewTranslations();

        return $this;
    }
918467
public function setTranslatable(TranslatableInterface $translatable = null)
    {
        if ($this->translatable == $translatable) {
            return $this;
        }
    
        $old = $this->translatable;
        $this->translatable = $translatable;
    
        if ($old !== null) {
            $old->removeTranslation($this);
        }
    
        if ($translatable !== null) {
            $translatable->addTranslation($this);
        }
    
        return $this;
    }
344824
public function setIdentifierMeta($meta): self
    {
        $this->meta    = $meta;
        $this->hasMeta = true;

        return $this;
    }
205037
public function withMetaId($id)
	{
		foreach (func_get_args() as $arg) {
			$meta_ids = (array) $arg;
			
			foreach ($meta_ids as $meta_id) {
				$this->filters[]['metas'][] = array('id' => $meta_id);
			}
		}
		
		return $this;
	}
1205911
public function addText($strText, $meta = array())
    {
        $objString = new StaticText($strText, $meta);
        $objString->setMeta("parent", $this, true);

        $this->__fields->addObject($objString);

        return $objString;
    }