1

WARNING | Property name "$_template" should not be prefixed with an underscore to indicate visibility

 <?php

namespace Marstranslation\Marstranslation\Block\Adminhtml\System\Config\Form\Field;

use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;

class LogoutSubmit extends Field
{
    /**
     * @var string
     */
    public $_template = 'Marstranslation_Marstranslation::system/config/logout_submit.phtml';
    private $dataHelper;
    /**
     * @param Context                                      $context
     * @param \Marstranslation\Marstranslation\Helper\Data $dataHelper
     * @param array                                        $data
     */
    public function __construct(
        Context $context,
        \Marstranslation\Marstranslation\Helper\Data $dataHelper,
        array $data = []
    ) {
        $this->dataHelper = $dataHelper;
        parent::__construct($context, $data);
    }

    /**
     * Remove scope label
     *
     * @param  AbstractElement $element
     * @return string
     */
    public function render(AbstractElement $element)
    {
        $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
        return parent::render($element);
    }
    /**
     * Return ajax url for loginSubmit button
     *
     * @return string
     */
    public function getAjaxUrl()
    {
        return $this->getUrl('marstranslation/system_config/logout/');
    }

    /**
     * Generate loginSubmit button html
     *
     * @return string
     */
    public function getButtonHtml()
    {
        $button = $this->getLayout()->createBlock(
            'Magento\Backend\Block\Widget\Button'
        )
            ->setData(
                [
                'id' => 'marsLogoutSubmit',
                'label' => __('Logout'),
                'class' => 'action-primary'
                ]
            );

        return $button->toHtml();
    }
}
1

This variable will be protected so change it to protected

protected $_template = 'Marstranslation_Marstranslation::system/config/logout_submit.phtml';

Either use the $this->setTemplate() or ignore the warning. You can check level

Error 10 A critical error with severity level 10 prevents an extension from passing technical review.

Warning 8 A severity level 8 warning does not prevent an extension from passing technical review. Developers are encouraged to resolve any issues that trigger a level 8 warning.

Warning 6 A severity level 6 warning does not prevent an extension from passing technical review. Developers are encouraged to resolve any issues that trigger a level 6 warning.

Here is detail

command for checking

phpcs --error-severity=1 --warning-severity=8
  • how i can check warning type is 6 or 8? – M RIZWAN Mar 7 '18 at 13:23
  • @MRIZWAN added the command – Qaisar Satti Mar 7 '18 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.