@return $this

@throws \Magento\Framework\Exception\LocalizedException
514259
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Post $post */
        $post = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('publish_fieldset', [
            'class'  => 'blog__post-fieldset',
            'legend' => __('Publish'),
        ]);

        $fieldset->addField('status', 'select', [
            'label'  => __('Status'),
            'name'   => 'post[status]',
            'value'  => $post->getStatus(),
            'values' => $this->status->toOptionArray(),
        ]);

        $fieldset->addField('created_at', 'date', [
            'label'       => __('Published on'),
            'name'        => 'post[created_at]',
            'value'       => $post->getCreatedAt(),
            'date_format' => 'MMM d, y',
            'time_format' => 'h:mm a',
        ]);

        $fieldset->addField('is_pinned', 'checkbox', [
            'label'   => __('Pin post at the top'),
            'name'    => 'post[is_pinned]',
            'value'   => 1,
            'checked' => $post->getIsPinned(),
        ]);

        return parent::_prepareForm();
    }
1094194
public function init()
    {
        $this->message = Swift_Message::newInstance(
            null,
            null,
            Config::get('content_type'),
            Config::get('charset')
        )
            ->setFrom(Config::get('addr'), Config::get('name'));

        return $this;
    }
29829
public function getParent()
    {
        $parent = $this->getEntity()->getParent();
        if ($parent) {
            return new self($parent, $this->locale);
        }

        return;
    }
376414
public function fromModelTable(): self
    {
        $this->from(
            $this->quoteSingleIdentifier($this->getTableName()),
            $this->quoteSingleIdentifier($this->getAlias())
        );

        return $this;
    }
224036
public function install()
    {
        $this->ensureNotInstalledBefore();

        if ($this->locator) {
            $this->path = $this->locator->locate($this->slug);
        }

        $this->validate();

        $this->make();

        $this->register();

        $this->migrate();

        $this->installSubAddons();

        AddonInstalledEvent::dispatch($this->addon);

        return $this;
    }
1102781
public function setCurrentLocaleByContext()
    {
        if (function_exists('apply_filters')) {
            // Give a chance for plugins to override this decision
            $locale = null;
            $locale = apply_filters('strata_i18n_set_current_locale_by_context', $locale);
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        if (!is_null($this->currentLocale)) {
            return $this->currentLocale;
        }

        $request = new Request();

        // Under ajax, one could post the value.
        if (Router::isAjax() && $request->hasPost("locale")) {
            $locale = $this->getLocaleByCode($request->post("locale"));
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        if ($request->hasGet("locale")) {
            $locale = $this->getLocaleByCode($request->get("locale"));
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        $inAdmin = function_exists('is_admin') ? is_admin() : false;
        if (!$inAdmin) {
            // This validates all locales but the default one
            $urls = implode('|', $this->getLocaleRegexUrls());

            if (array_key_exists('REQUEST_URI', (array)$_SERVER)) {
                if (preg_match('/^\/('.$urls.')\//i', $_SERVER['REQUEST_URI'], $match)) {
                    $locale = $this->getLocaleByUrl($match[1]);
                    if (!is_null($locale)) {
                        return $this->setLocale($locale);
                    }
                // Also validates for lack of locale code, meaning
                // a possible default locale match when no ajax-ing.
                } elseif (preg_match('/^(?:(?!'.$urls.'))\/?/i', $_SERVER['REQUEST_URI'])) {
                    $locale = $this->getDefaultLocale();
                    if (!is_null($locale)) {
                        return $this->setLocale($locale);
                    }
                }
            }
        }

        if ($this->hasLocaleInSession()) {
            $locale = $this->getLocaleInSession();
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        if ($this->hasDefaultLocale()) {
            return $this->setLocale($this->getDefaultLocale());
        }
    }
431436
public function prepare()
    {
        if (null === $this->statement) {
            $this->statement = $this->db->prepare($this->getSql());
        }

        return $this;
    }
410664
public function & InitAll () {
		/** @var $this \MvcCore\Route */
		if ($this->match === NULL && $this->reverse === NULL) {
			$this->initMatchAndReverse();
		} else if ($this->match !== NULL && ($this->reverseParams === NULL || $this->lastPatternParam === NULL)) {
			$this->initReverse();
		}
		return $this;
	}
585169
public function getType() {
        if($this->typeInstance !== null) {
            return $this->typeInstance;
        }

        if(isset(static::$types[$this->type])) {
            $this->typeInstance = static::$types[$this->type];

            return static::$types[$this->type];
        } else {
            if(static::$defaultType !== null) {
                $this->typeInstance = static::$defaultType;

                return static::$defaultType;
            } else {
                throw new Exception('No `FieldType` Object Set For Field Type "' . $this->type . '" And No Default Set');
            }
        }
    }
1094877
public function self()
    {
        $result = $this->itemIterator ? $this->itemIterator->current() : $this->item;
        $this->resetLocalScope();

        return $result;
    }
1252596
public function getLocale()
    {
        $locale = $this->requestStack->getCurrentRequest() instanceof Request
            ? $this->requestStack->getCurrentRequest()->getLocale()
            : $this->defaultLocale;

        return Locale::create($locale);
    }
202940
public function remove(): self
    {
        if ($this->_parent) {
            $id = spl_object_hash($this);
            unset($this->_parent->_children[$id]);
            unset($this->_parent);
        }
        return $this;
    }
1084413
public function init() {
		if ($this->initialized)
			return $this;
		$this->initialized = true;
		$this->check_tables();
		return $this;
	}
1165772
public function append()
    {
        $this->importNodes(\func_get_args(), function ($node, $imported_node) {
            $node->appendChild($imported_node);
        });

        return $this;
    }
173578
public function bind()
    {
        if (func_num_args()) {
            $bindings = new Bindings(func_get_args(), $this->rules);
            $this->rules = $bindings->rules();
        }

        return $this;
    }
1283487
public function getLocales()
    {
        $this->start();
        try {
            $this->getUserControl()->checkRateLimit();
            $this->getUserControl()->checkGenericAccess(__FUNCTION__);
            $locales = $this->app->make(LocaleRepository::class)->getApprovedLocales();
            $result = $this->buildJsonResponse($this->localesToArray($locales));
        } catch (Exception $x) {
            $result = $this->buildErrorResponse($x);
        } catch (Throwable $x) {
            $result = $this->buildErrorResponse($x);
        }

        return $this->finish($result);
    }
1025444
public function getParentLocale() {
        if ($this->_parent) {
            return $this->_parent;
        }

        if (!$this->hasConfig('parent')) {
            return null;
        }

        $parent = new Locale($this->getConfig('parent'));
        $parent->initialize();

        // Merge parent config
        $this->addConfig($this->allConfig() + $parent->allConfig());

        $this->_parent = $parent;

        return $parent;
    }