SproutCMS

This is the code documentation for the SproutCMS project

source of /modules/HomePage/Controllers/Admin/HomePageAdminController.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13.  
  14. namespace SproutModules\Karmabunny\HomePage\Controllers\Admin;
  15.  
  16. use Sprout\Controllers\Admin\ManagedAdminController;
  17. use Sprout\Controllers\Admin\PageAdminController;
  18. use Sprout\Helpers\Pdb;
  19.  
  20.  
  21. /**
  22. * Showing and editing of the home page
  23. **/
  24. class HomePageAdminController extends ManagedAdminController
  25. {
  26. protected $controller_name = 'home_page';
  27. protected $friendly_name = 'Home page';
  28. protected $navigation_name = 'Pages';
  29. protected $table_name = 'homepages';
  30. protected $main_delete = false;
  31.  
  32.  
  33. /**
  34.   * Return the fields to show in the sidebar when adding or editing a record.
  35.   * These fields are shown under a heading of "Visibility"
  36.   * @return array Key is the field name, value is the field label
  37.   */
  38. public function _getVisibilityFields()
  39. {
  40. return [];
  41. }
  42.  
  43.  
  44. public function _identifier(array $row)
  45. {
  46. return Pdb::q("SELECT name FROM ~subsites WHERE id = ?", [$row['subsite_id']], 'val');
  47. }
  48.  
  49.  
  50. /**
  51.   * Proxies navigation to the 'page' controller.
  52.   **/
  53. public function _getNavigation()
  54. {
  55. $pages = new PageAdminController();
  56. return $pages->_getNavigation();
  57. }
  58.  
  59.  
  60. /**
  61.   * Proxies tools to the 'page' controller.
  62.   **/
  63. public function _getTools()
  64. {
  65. $ctlr = new PageAdminController();
  66. return $ctlr->_getTools();
  67. }
  68.  
  69.  
  70. /**
  71.   * Gets the name of the controller to use for the top nav
  72.   **/
  73. public function getTopnavName()
  74. {
  75. return 'page';
  76. }
  77.  
  78.  
  79. public function _getAddForm() { return null; }
  80. public function _addSave(&$id) { return null; }
  81. }
  82.  
  83.  
  84.