Commit ec50d25e authored by gisle's avatar gisle
Browse files

Done by gisle: Replaced hook_admin_paths with hook_admin_paths_alter

parent fc02514a
...@@ -50,15 +50,12 @@ function advanced_help_help($path, $arg) { ...@@ -50,15 +50,12 @@ function advanced_help_help($path, $arg) {
} }
/** /**
* Implements hook_admin_paths(). * Implements hook_admin_paths_alter().
* *
* Force help pages for this modile to be rendered in admin theme. * Force help pages for this module to be rendered in admin theme.
*/ */
function advanced_help_admin_paths() { function advanced_help_admin_paths_alter(&$paths) {
$paths = array( $paths['help/advanced_help/*'] = TRUE;
'help/advanced_help/*' => TRUE,
);
return $paths;
} }
/** /**
......
...@@ -52,6 +52,11 @@ ...@@ -52,6 +52,11 @@
padding: .5em; padding: .5em;
} }
.nav {
color: #093;
background: #f6f6f6;
font-family: Arial Narrow, Arial, sans-serif;
}
.attribution { .attribution {
font-size: 0.8em; font-size: 0.8em;
color: #aaa; color: #aaa;
......
...@@ -65,7 +65,7 @@ enclose it in quotes. (This setting is currently not optional.)</dd> ...@@ -65,7 +65,7 @@ enclose it in quotes. (This setting is currently not optional.)</dd>
<dt><code>file</code> (topic name)</dt> <dt><code>file</code> (topic name)</dt>
<dd>The filename, without the .html extension, used for the file with <dd>The filename, without the .html extension, used for the file with
the help text for the topic. This is optional; if not specified, the the help text for the topic. This is optional; if not specified, the
topic name wil be the file name.</dd> topic name will be the file name.</dd>
<dt><code>weight</code> (0)</dt> <dt><code>weight</code> (0)</dt>
<dd>The weight, used for sorting topics on the administration <dd>The weight, used for sorting topics on the administration
......
...@@ -8,14 +8,6 @@ files are distributed from the project Drupal.org repo in the same ...@@ -8,14 +8,6 @@ files are distributed from the project Drupal.org repo in the same
package as the module or theme, and placed in a subdirectory named package as the module or theme, and placed in a subdirectory named
<code>help</code> in the project or theme directory.</p> <code>help</code> in the project or theme directory.</p>
<p>The help texts can be marked up with standard HTML. The help pages
will be rendered using your site's administrative theme. Having a
simple simple one-column, tableless, fluid width administration theme
(e.g. <strong>Seven</strong>) is strongly recommended.</p>
<p>You may attach custom css to a project that uses <strong>Advanced
help</strong> to provide help.</p>
<p>The help texts can be placed in an hierarchical book, allowing for <p>The help texts can be placed in an hierarchical book, allowing for
top-down navigation, or programmatically placed in popups that can be top-down navigation, or programmatically placed in popups that can be
added to a page with plain text links or themed icon links.</p> added to a page with plain text links or themed icon links.</p>
...@@ -23,7 +15,6 @@ added to a page with plain text links or themed icon links.</p> ...@@ -23,7 +15,6 @@ added to a page with plain text links or themed icon links.</p>
<p>If there is a <code>README.md</code> or <code>README.txt</code> in <p>If there is a <code>README.md</code> or <code>README.txt</code> in
the package, the content of that file may be shown as well.</p> the package, the content of that file may be shown as well.</p>
<p>Cross-linking book-sections,using fragment identifiers, works as <p>Cross-linking book-sections,using fragment identifiers, works as
one would expect.</p> one would expect.</p>
...@@ -40,8 +31,7 @@ project's hierarchy.</p> ...@@ -40,8 +31,7 @@ project's hierarchy.</p>
module module
<a href="https://www.drupal.org/project/advanced_help_hint"><strong>Advanced help hint</strong></a>.</p> <a href="https://www.drupal.org/project/advanced_help_hint"><strong>Advanced help hint</strong></a>.</p>
<h2 id="demo">Demonstration</h2>
<h2 id="demo">Demonstrations</h2>
<p>The project comes with a small demo module named <p>The project comes with a small demo module named
<strong>Advanced help example</strong> to demonstrate how it works. <strong>Advanced help example</strong> to demonstrate how it works.
...@@ -55,4 +45,32 @@ advanced help features, see the <strong>Views</strong> project.</p> ...@@ -55,4 +45,32 @@ advanced help features, see the <strong>Views</strong> project.</p>
directory <code>translations/help/nb</code> in the <strong>Advanced directory <code>translations/help/nb</code> in the <strong>Advanced
help example</strong> submodule. For translation instructions, see the help example</strong> submodule. For translation instructions, see the
section named “<a href="&topic:advanced_help/translation&">Translating section named “<a href="&topic:advanced_help/translation&">Translating
advanced help</a>”.</p> advanced help</a>”.</p>
<h2 id="theme">Theme</h2>
<p>The <strong>Advanced help</strong> and
<strong>Advanced help example</strong> modules implements
<code>hook_admin_paths_alter()</code> to render the help
texts rendered using the site's administrative theme.
The <code>help.css</code> provided is created with the
theme <strong>Seven</strong> in mind. Using a different
administrative theme may require you to create custom css for the
site.</p>
<p>The contributed module
<a href="https://www.drupal.org/project/admin_path"><strong>Administrative pages</strong></a>
seems to override <code>hook_admin_paths_alter()</code>. If you use this module,
you also need to navigate to
<span class="nav">Configuration » User interface » Administrative pages</span>
and declare these paths as administrative pages:</p>
<pre>
help/advanced_help/*
help/help_example/*
</pre>
<p>You may attach your own custom css to any project that
uses <strong>Advanced help</strong> to provide help.</p>
...@@ -67,10 +67,11 @@ named parameters passed in an array:</p> ...@@ -67,10 +67,11 @@ named parameters passed in an array:</p>
<ol> <ol>
<li><code>'module'</code>: The machine name of the module that owns this help topic.</li> <li><code>'module'</code>: The machine name of the module that owns this help topic.</li>
<li><code>'topic'</code>: The identifier for the topic.</li> <li><code>'topic'</code>: The identifier for the topic (to link to topic) or <code>'toc'</code> (to link to index page).</li>
</ul></li>
<li><code>'type'</code>: The type of link to create:<ul> <li><code>'type'</code>: The type of link to create:<ul>
<li>'<code>icon'</code> to display the question mark icon</li> <li>'<code>icon'</code> to display the question mark icon.</li>
<li>'<code>title'</code> to display the topic's title</li> <li>'<code>title'</code> to display the topic's title.</li>
<li>any other text to display the text. Wrap it in <code>t()</code> to make it translatable.</li> <li>any other text to display the text. Wrap it in <code>t()</code> to make it translatable.</li>
</ul></li> </ul></li>
</ol> </ol>
...@@ -112,6 +113,9 @@ $output .= '&nbsp;' . t('Click the help icon!'); ...@@ -112,6 +113,9 @@ $output .= '&nbsp;' . t('Click the help icon!');
<div class="help-img-caption" style="max-width:180px">Question mark help icon</div> <div class="help-img-caption" style="max-width:180px">Question mark help icon</div>
</div> </div>
<p>See the source code of demo module <strong>Advanced help
example</strong> for link examples.</p>
<p>You may link to other help topics inside your HTML help file using <p>You may link to other help topics inside your HTML help file using
this format:</p> this format:</p>
...@@ -146,14 +150,14 @@ to <code>href=""</code> and <code>src=""</code> parameters.</p> ...@@ -146,14 +150,14 @@ to <code>href=""</code> and <code>src=""</code> parameters.</p>
<p>When this module is installed, users with the <p>When this module is installed, users with the
<code>view advanced help index</code> <code>view advanced help index</code>
permission can access the advanced help index by going to permission can access the advanced help index by navigating to
<em>Administer » Advanced Help</em> <span class="nav">Help » Advanced Help</span>.
(<code>admin/advanced_help</code>). Additional permissions Additional permissions
<code>view advanced help topic</code> and <code>view advanced help topic</code> and
<code>view advanced help popup</code> allows the user to click <code>view advanced help popup</code> allows the user to click
trough to the actual help pages and popups.</p> trough to the actual help pages and popups.</p>
<p>By taking away thes permissions from a role, a site can “hide” the <p>By taking away these permissions from a role, a site can “hide” the
direct access to these topics and popup. Note that this does not direct access to these topics and popup. Note that this does not
restrict <em>access</em>, as the contents of an unprotected HTML-file restrict <em>access</em>, as the contents of an unprotected HTML-file
on a Drupal website can be viewed by anyone who know (or is able to on a Drupal website can be viewed by anyone who know (or is able to
...@@ -180,7 +184,7 @@ protection from direct access.</p> ...@@ -180,7 +184,7 @@ protection from direct access.</p>
<h2 id="search">Search</h2> <h2 id="search">Search</h2>
<p>To enable advanced help search, navigate to <p>To enable advanced help search, navigate to
<em>Administration » Configuration » Search and metadata » Search settings</em>. <span class="nav">Administration » Configuration » Search and metadata » Search settings</span>.
Scroll down to <em>Active search modules</em> and tick the box to the Scroll down to <em>Active search modules</em> and tick the box to the
left of “Advanced help”. The search form will appear on the top of left of “Advanced help”. The search form will appear on the top of
the advanced help index pages.</p> the advanced help index pages.</p>
...@@ -188,6 +192,6 @@ the advanced help index pages.</p> ...@@ -188,6 +192,6 @@ the advanced help index pages.</p>
<p>If the core <strong>Search</strong> module is enabled, the contents <p>If the core <strong>Search</strong> module is enabled, the contents
of the advanced help framework will be indexed on cron. If you enable of the advanced help framework will be indexed on cron. If you enable
new modules or themes and wish to immediately index their help text, new modules or themes and wish to immediately index their help text,
navigate to <em>Administration » Reports » Status report</em> and navigate to <span class="nav">Reports » Status report</span> and
click the link “run cron manually”.</p> click the link “run cron manually”.</p>
...@@ -2,17 +2,18 @@ ...@@ -2,17 +2,18 @@
<strong>Advanced help</strong> framework. If you have the appropriate <strong>Advanced help</strong> framework. If you have the appropriate
permissions, you may view the contents of this and other HTML help permissions, you may view the contents of this and other HTML help
files. To view it as an hierarchical manual or book, you navigate to files. To view it as an hierarchical manual or book, you navigate to
<em>Help » Advanced help » Advanced help example » About help example</em>. <span class="nav">Help » Advanced help » Advanced help example » About help example</span>.
To view it as a popup, click on <em>Example help</em> in the black To view it as a popup, click on Example help in the black
administrative toolbar and click on the question mark icon.</p> administrative toolbar and click on the question mark icon.</p>
<p>To try out the search features, first enable advanced help search, <p>To try out the search features, first enable advanced help search,
then run cron to index the help pages.</p> then run cron to index the help pages.</p>
<p>You may also want to read up on <a href="&topic:help_example/lorem&">Lorem ipsum</a>.</p> <p>You may also want to read up on <a href="&topic:help_example/lorem&">Lorem ipsum</a>.</p>
<!--
<ol> <ol>
<li><code>topic</code>: &topic:help_example/lorem&</li> <li><code>topic</code>: &topic:help_example/lorem&</li>
<li><code>path</code>: &path&</li> <li><code>path</code>: &path&</li>
<li><code>trans_path</code>: &trans_path&</li> <li><code>trans_path</code>: &trans_path&</li>
</ol> </ol>
-->
...@@ -5,15 +5,12 @@ ...@@ -5,15 +5,12 @@
*/ */
/** /**
* Implements hook_admin_paths(). * Implements hook_admin_paths_alter().
* *
* Force help pages for this modile to be rendered in admin theme. * Force help pages for this module to be rendered in admin theme.
*/ */
function help_example_admin_paths() { function help_example_admin_paths_alter(&$paths) {
$paths = array( $paths['help/help_example/*'] = TRUE;
'help/help_example/*' => TRUE,
);
return $paths;
} }
/** /**
......
...@@ -2,17 +2,11 @@ ...@@ -2,17 +2,11 @@
<strong>Avansert hjelp</strong>. Dersom du har de riktige tillatelsene, kan du <strong>Avansert hjelp</strong>. Dersom du har de riktige tillatelsene, kan du
se innholdet i denne og andre HTML-veiledningsfiler. For å se det som en se innholdet i denne og andre HTML-veiledningsfiler. For å se det som en
del av den hierarkiske boken som er synlig når du navigerer til del av den hierarkiske boken som er synlig når du navigerer til
<em>Hjelp » Advanced help » Eksempel på avansert hjelp » Om eksempel på hjelp</em>. <span class="nav">Hjelp » Avansert hjelp » Eksempel på avansert hjelp » Om eksempel på hjelp (oversatt)</span>.
For å vise det som en popup klikker du på <em>Example help</em> i den svarte For å vise det som en popup klikker du på Example help i den svarte
administrative verktøylinjen og deretter klikker på spørsmålstegnikonet.</p> administrative verktøylinjen og deretter klikker på spørsmålstegnikonet.</p>
<p>For å prøve søkefunksjonene, aktiver først advanced help search. Kjør <p>For å prøve søkefunksjonene, aktiver først advanced help search. Kjør
deretter cron for å indeksere hjelpesidene.</p> deretter cron for å indeksere hjelpesidene.</p>
<p>Du kan også lese om <a href="&topic:help_example/lorem&">Lorem ipsum</a>.</p> <p>Du kan også lese om <a href="&topic:help_example/lorem&">Lorem ipsum</a>.</p>
<ol>
<li><code>topic</code>: &topic:help_example/lorem&</li>
<li><code>path</code>: &path&</li>
<li><code>trans_path</code>: &trans_path&</li>
</ol>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment