Guest User

Untitled

a guest
Jun 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. /**
  2. * Returns the location of the RTE
  3. *
  4. * @param string The table name
  5. * @param array The current row from which field is being rendered
  6. * @return array Config order!
  7. */
  8. function whereAmI($table,$row) {
  9. // Initial location is set to: Default config, then the table name
  10. $where = array('default',$table);
  11.  
  12. // Custom location based on table name
  13. switch ($table) {
  14. case 'tt_content':
  15. // location based on tablename + tt_content column position is added
  16. $where[] = $table.'.colPos'.$row['colPos'];
  17.  
  18. // TemplaVoila is installed
  19. if (t3lib_extMgm::isLoaded('templavoila')) {
  20. require_once(t3lib_extMgm::extPath('templavoila').'class.tx_templavoila_api.php');
  21. $tvAPI = t3lib_div::makeInstance('tx_templavoila_api');
  22.  
  23. // Add all nested TV fields to location
  24. $tmp = array();
  25. $flex = array('table' => $table, 'uid' => $row['uid']);
  26. while ($flex['table'] == $table) {
  27. $flex = array_shift($tvAPI->flexform_getPointersByRecord($flex['uid'], $row['pid']));
  28. // location based on tablename + TV field name is added
  29. $tmp[] = $table.'.'.$flex['field'];
  30. }
  31. $where = array_merge($where,array_reverse($tmp));
  32. }
  33. break;
  34. }
  35. // A hook could be inserted here, to allow pre-processing of custom tables
  36.  
  37. return $where;
  38. }
  39.  
  40. function getTextarea($parentObject, $PA, $value, $config) {
  41. $code = $this->triggerField($PA['itemFormElName']);
  42. $code .= '<textarea id="RTEarea'.$parentObject->RTEcounter.'" class="tinymce_rte" name="'.htmlspecialchars($PA['itemFormElName']).'" rows="30" cols="100">'.t3lib_div::formatForTextarea($value).'</textarea>';
  43.  
  44. if ( !$config['useFEediting'] ) {
  45. $config['init.']['window'] = 'self';
  46. $config['init.']['element_id'] = 'RTEarea' . $parentObject->RTEcounter;
  47. $config['init.']['reAddCss'] = 'true';
  48. $code .= '
  49. <script type="text/javascript">
  50. top.tinyMCE.execCommand("mceAddFrameControl", false, ' . $this->parseConfig($config['init.']) . ');
  51. </script>
  52. ';
  53. } else {
  54. $code .= $this->getCoreScript( $config );
  55. $code .= $this->getInitScript( $config['init.'] );
  56. }
  57. return $code;
  58. }
Add Comment
Please, Sign In to add comment