Can someone explain me the use of getHeaderText() method in magento

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












in block/adminhtml/items.php file there is one method



public function getHeaderText()

$item = $this->_coreRegistry->registry('current_bhakti_magento2_items');
if ($item->getId())
return __("Edit Item '%1'", $this->escapeHtml($item->getName()));
else
return __('New Item');




I dont get how it works.







share|improve this question


























    up vote
    1
    down vote

    favorite












    in block/adminhtml/items.php file there is one method



    public function getHeaderText()

    $item = $this->_coreRegistry->registry('current_bhakti_magento2_items');
    if ($item->getId())
    return __("Edit Item '%1'", $this->escapeHtml($item->getName()));
    else
    return __('New Item');




    I dont get how it works.







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      in block/adminhtml/items.php file there is one method



      public function getHeaderText()

      $item = $this->_coreRegistry->registry('current_bhakti_magento2_items');
      if ($item->getId())
      return __("Edit Item '%1'", $this->escapeHtml($item->getName()));
      else
      return __('New Item');




      I dont get how it works.







      share|improve this question












      in block/adminhtml/items.php file there is one method



      public function getHeaderText()

      $item = $this->_coreRegistry->registry('current_bhakti_magento2_items');
      if ($item->getId())
      return __("Edit Item '%1'", $this->escapeHtml($item->getName()));
      else
      return __('New Item');




      I dont get how it works.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 4 at 6:03









      Bhakti Thakkar

      13511




      13511




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          The function getHeaderText() sets the page heading in the admin form. The usage is simple.



          When Magento finds the ID parameter, it assumes that the page an edit form. Based on that it sets the page heading like:




          Edit Item [Item Name]




          If the ID is not available, it sets the form heading as the new item form.



          Below is the simple demonstration of the scenario:



          New Record:
          New record



          Edit Record:
          Edit Record






          share|improve this answer




















          • thank you so much, sir!
            – Bhakti Thakkar
            Sep 4 at 7:04










          • @bhakti, glad that I could help. :)
            – Mohit Kumar Arora
            Sep 4 at 9:18

















          up vote
          1
          down vote













          getHeaderText() is used to add the form title in your admin form.



          Navigate to the following path




          vendor/magento/module-backend/Block/Widget/Form/Container.php




          You will get the function with name getHeaderHtml() which contains the getHeaderText() function.



          <?php 

          ...
          ...

          /**
          * @return string
          */
          public function getHeaderHtml()

          return '<h3 class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';






          share|improve this answer




















          • thank you so much, sir
            – Bhakti Thakkar
            Sep 4 at 7:05










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f240685%2fcan-someone-explain-me-the-use-of-getheadertext-method-in-magento%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          The function getHeaderText() sets the page heading in the admin form. The usage is simple.



          When Magento finds the ID parameter, it assumes that the page an edit form. Based on that it sets the page heading like:




          Edit Item [Item Name]




          If the ID is not available, it sets the form heading as the new item form.



          Below is the simple demonstration of the scenario:



          New Record:
          New record



          Edit Record:
          Edit Record






          share|improve this answer




















          • thank you so much, sir!
            – Bhakti Thakkar
            Sep 4 at 7:04










          • @bhakti, glad that I could help. :)
            – Mohit Kumar Arora
            Sep 4 at 9:18














          up vote
          1
          down vote



          accepted










          The function getHeaderText() sets the page heading in the admin form. The usage is simple.



          When Magento finds the ID parameter, it assumes that the page an edit form. Based on that it sets the page heading like:




          Edit Item [Item Name]




          If the ID is not available, it sets the form heading as the new item form.



          Below is the simple demonstration of the scenario:



          New Record:
          New record



          Edit Record:
          Edit Record






          share|improve this answer




















          • thank you so much, sir!
            – Bhakti Thakkar
            Sep 4 at 7:04










          • @bhakti, glad that I could help. :)
            – Mohit Kumar Arora
            Sep 4 at 9:18












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          The function getHeaderText() sets the page heading in the admin form. The usage is simple.



          When Magento finds the ID parameter, it assumes that the page an edit form. Based on that it sets the page heading like:




          Edit Item [Item Name]




          If the ID is not available, it sets the form heading as the new item form.



          Below is the simple demonstration of the scenario:



          New Record:
          New record



          Edit Record:
          Edit Record






          share|improve this answer












          The function getHeaderText() sets the page heading in the admin form. The usage is simple.



          When Magento finds the ID parameter, it assumes that the page an edit form. Based on that it sets the page heading like:




          Edit Item [Item Name]




          If the ID is not available, it sets the form heading as the new item form.



          Below is the simple demonstration of the scenario:



          New Record:
          New record



          Edit Record:
          Edit Record







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 4 at 6:49









          Mohit Kumar Arora

          5,27541332




          5,27541332











          • thank you so much, sir!
            – Bhakti Thakkar
            Sep 4 at 7:04










          • @bhakti, glad that I could help. :)
            – Mohit Kumar Arora
            Sep 4 at 9:18
















          • thank you so much, sir!
            – Bhakti Thakkar
            Sep 4 at 7:04










          • @bhakti, glad that I could help. :)
            – Mohit Kumar Arora
            Sep 4 at 9:18















          thank you so much, sir!
          – Bhakti Thakkar
          Sep 4 at 7:04




          thank you so much, sir!
          – Bhakti Thakkar
          Sep 4 at 7:04












          @bhakti, glad that I could help. :)
          – Mohit Kumar Arora
          Sep 4 at 9:18




          @bhakti, glad that I could help. :)
          – Mohit Kumar Arora
          Sep 4 at 9:18












          up vote
          1
          down vote













          getHeaderText() is used to add the form title in your admin form.



          Navigate to the following path




          vendor/magento/module-backend/Block/Widget/Form/Container.php




          You will get the function with name getHeaderHtml() which contains the getHeaderText() function.



          <?php 

          ...
          ...

          /**
          * @return string
          */
          public function getHeaderHtml()

          return '<h3 class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';






          share|improve this answer




















          • thank you so much, sir
            – Bhakti Thakkar
            Sep 4 at 7:05














          up vote
          1
          down vote













          getHeaderText() is used to add the form title in your admin form.



          Navigate to the following path




          vendor/magento/module-backend/Block/Widget/Form/Container.php




          You will get the function with name getHeaderHtml() which contains the getHeaderText() function.



          <?php 

          ...
          ...

          /**
          * @return string
          */
          public function getHeaderHtml()

          return '<h3 class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';






          share|improve this answer




















          • thank you so much, sir
            – Bhakti Thakkar
            Sep 4 at 7:05












          up vote
          1
          down vote










          up vote
          1
          down vote









          getHeaderText() is used to add the form title in your admin form.



          Navigate to the following path




          vendor/magento/module-backend/Block/Widget/Form/Container.php




          You will get the function with name getHeaderHtml() which contains the getHeaderText() function.



          <?php 

          ...
          ...

          /**
          * @return string
          */
          public function getHeaderHtml()

          return '<h3 class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';






          share|improve this answer












          getHeaderText() is used to add the form title in your admin form.



          Navigate to the following path




          vendor/magento/module-backend/Block/Widget/Form/Container.php




          You will get the function with name getHeaderHtml() which contains the getHeaderText() function.



          <?php 

          ...
          ...

          /**
          * @return string
          */
          public function getHeaderHtml()

          return '<h3 class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 4 at 6:42









          Dinesh Yadav

          3,1671730




          3,1671730











          • thank you so much, sir
            – Bhakti Thakkar
            Sep 4 at 7:05
















          • thank you so much, sir
            – Bhakti Thakkar
            Sep 4 at 7:05















          thank you so much, sir
          – Bhakti Thakkar
          Sep 4 at 7:05




          thank you so much, sir
          – Bhakti Thakkar
          Sep 4 at 7:05

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f240685%2fcan-someone-explain-me-the-use-of-getheadertext-method-in-magento%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          One-line joke