variants.lib.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /* Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file /variants/lib/variants.lib.php
  19. * \ingroup variants
  20. * \brief Library files with common functions for Variants
  21. */
  22. /**
  23. * Prepare array with list of tabs
  24. *
  25. * @param Product $object Object related to tabs
  26. * @return array Array of tabs to show
  27. */
  28. function productAttributePrepareHead($object)
  29. {
  30. global $langs, $conf;
  31. $langs->load("products");
  32. $h = 0;
  33. $head = array();
  34. $head[$h][0] = DOL_URL_ROOT.'/variants/card.php?id='.$object->id;
  35. $head[$h][1] = $langs->trans("ProductAttribute");
  36. $head[$h][2] = 'card';
  37. $h++;
  38. // Show more tabs from modules
  39. // Entries must be declared in modules descriptor with line
  40. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  41. // $this->tabs = array('entity:-tabname); to remove a tab
  42. complete_head_from_modules($conf, $langs, $object, $head, $h, 'product_attribute');
  43. complete_head_from_modules($conf, $langs, $object, $head, $h, 'product_attribute', 'remove');
  44. return $head;
  45. }