public function SimpleDialogExampleController::examplesPageContent in Simple Dialog 8
@todo - Render from twig template diretly?
1 string reference to 'SimpleDialogExampleController::examplesPageContent'
- simple_dialog_example.routing.yml in simple_dialog_example/
simple_dialog_example.routing.yml - simple_dialog_example/simple_dialog_example.routing.yml
File
- simple_dialog_example/
lib/ Drupal/ simple_dialog_example/ Controller/ SimpleDialogExampleController.php, line 10
Class
Namespace
Drupal\simple_dialog_example\ControllerCode
public function examplesPageContent() {
$output = '<h2>HTML Implementation</h2>';
$output .= '<p>Here are some examples of implementations using just html mark-up.</p>';
$output .= '<p>This first one is the simplest implementation using no specific jQuery ui settings:</p>';
$output .= '<p><pre>
<a href="' . base_path() . 'simple-dialog-example/target-page" class="simple-dialog" name="load-this-element" title="My Dialog Title">Click Me To See The Dialog</a></pre></p>';
$output .= '<p><a href="' . base_path() . 'simple-dialog-example/target-page" class="simple-dialog" name="load-this-element" title="My Dialog Title">Click Me To See The Dialog</a></p>';
$output .= '<p>This implements some custom jQuery ui dialog settings in the "rel" tag of the anchor element:</p>';
$output .= '<p><pre>
<a href="' . base_path() . 'simple-dialog-example/target-page" class="simple-dialog" name="load-this-element" title="My Dialog Title" rel="width:900;resizable:false;position:[center,60];">Click Me To See The Dialog</a></pre></p>';
$output .= '<p><a href="' . base_path() . 'simple-dialog-example/target-page" class="simple-dialog" name="load-this-element" title="My Dialog Title" rel="width:900;resizable:false;position:[center,60];">Click Me To See The Dialog</a></p>';
$output .= '<h2>Theme Implementation</h2>';
$output .= '<p>This is an example outputting the dialog link using the simple_dialog_link theme implementation:</p>';
$output .= '<p><pre>
$element = ' . "array(\n '#theme' => 'simple_dialog_link',\n '#text' => 'Click Me To See The Dialog',\n '#path' => '/simple-dialog-example/target-page',\n '#selector' => 'load-this-element',\n '#title' => 'My Dialog Title',\n '#options' => array(\n 'width' => 900,\n 'resizable' => FALSE,\n 'position' => array('center', 60) // can be an array of xy values\n ),\n '#class' => array('my-link-class'),\n);\ndrupal_render(\$element);\n</pre></p>";
$element = array(
'#theme' => 'simple_dialog_link',
'#text' => 'Click Me To See The Dialog',
'#path' => '/simple-dialog-example/target-page',
'#selector' => 'load-this-element',
'#title' => 'My Dialog Title',
'#options' => array(
'width' => 900,
'resizable' => FALSE,
'position' => array(
'center',
60,
),
),
'#class' => array(
'my-link-class',
),
);
$output .= '<p>' . drupal_render($element) . '</p>';
return array(
'#type' => 'markup',
'#markup' => $output,
);
}