You are here

function _field_hidden_help in Field Hidden 7

Helper for field_hidden_help(), which implements hook_help().

Parameters

string $path:

unknown $arg:

  • default: NULL

Return value

string|void

1 call to _field_hidden_help()
field_hidden_help in ./field_hidden.module
Implements hook_help().

File

./field_hidden.admin.inc, line 40
Drupal Field Hidden module administration

Code

function _field_hidden_help($path, $arg = NULL) {
  $css = str_replace('_', '-', $module = 'field_hidden');
  if ($path != 'admin/help#' . $module) {
    return;
  }
  $module_path = drupal_get_path('module', $module);
  $primary_function = FALSE;

  //$module;
  $content_main = '<h3>' . t('About') . '</h3>' . '<p>' . t('The Field Hidden module defines five hidden field types - text, long text, integer, decimal, and floating-point.', array(
    '@field-help' => url('admin/help/field'),
  )) . '</p>' . '<h5>' . t('Hidden field types reflect data types') . '</h5>' . '<p>' . t('The only difference between text and long text is the database data type used - varchar versus text (MySQL: longtext).') . '<br/>' . t('Neither allow HTML nor PHP, only plain text.') . '</p>' . '<p>' . t('The numeric types correspond to the data types integer, decimal and float.') . '<br/>' . t('Decimal is often the better choice when it comes to decimal/floating numbers because it usually allows for a higher number of precise digits (typically 14) than float/double database fields do.') . '</p>' . '<h5>' . t('Hidden - in what sense?') . '</h5>' . '<p>' . t('A hidden field will always be hidden when editing a node/entity - an &lt;input type=&quot;hidden&quot; /&gt; form element.') . '<br/>' . t('When a node/entity is displayed on a page, these hidden fields default to be fully hidden (kept out the page\'s HTML output entirely).') . '<br/>' . t('The value of a hidden field may however be displayed in output, if another format than &lt;Hidden&gt; is selected in the content type\'s \'@manage_display\' section.', array(
    '@manage_display' => t('Manage Display'),
  )) . '</p>';
  drupal_add_css($module_path . '/' . $module . '.admin.css', array(
    'type' => 'file',
    'group' => CSS_DEFAULT,
    'preprocess' => FALSE,
    'every_page' => FALSE,
  ));
  $out = '<div><div class="admin-help-module-' . $css . '-pane-first">' . $content_main;

  //  Read primary function's documentation.
  if ($primary_function && strlen($read_source = @file_get_contents($module_path . '/' . $module . '.module'))) {
    $pos_end = strpos($read_source, "\nfunction " . $primary_function . '(');
    $s_start = substr($read_source, 0, $pos_end);
    $s_start = substr($s_start, strrpos($s_start, '/**'));
    $s_end = substr($read_source, $pos_end);
    $pos_end = strpos($s_end, ')');
    $s = str_replace("\r", '', $s_start . substr($s_end, 0, $pos_end + 1));
    $s = preg_replace('/\\n([^\\n]+)$/', "\n" . '<strong>$1 {...}</strong>', preg_replace('/^([^\\n]+)\\n/', '<strong>$1</strong>' . "\n", str_replace("\n- ", "\n&bull; ", str_replace("\n/", "\n", preg_replace('/\\n \\*[ \\t]*/', "\n", str_replace('/**', '', $s))))));
    $out .= '<p>' . nl2br(preg_replace('/\\n\\n/', '</p><p>', $s)) . '</p>';
  }
  $out .= '</div><div class="admin-help-module-' . $css . '-pane-second">';

  //  Parse README.txt to html.
  $out .= '<a name="readme"></a><h3>Readme</h3>';
  $readme = @file_get_contents(substr(dirname(__FILE__), 0, -1 * (1 + strlen($module_path))) . '/' . $module_path . '/README.txt');
  $func = '_' . $module . '_readme2html';
  $out .= $func($readme) . '</div></div><hr/>';
  return $out;
}