本文整理汇总了PHP中Drupal\Component\Utility\Html::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::getId方法的具体用法?PHP Html::getId怎么用?PHP Html::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Component\Utility\Html
的用法示例。
在下文中一共展示了Html::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("set" => 36, "block" => 38);
$filters = array("clean_id" => 36, "without" => 37);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'block'), array('clean_id', 'without'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 36
$context["heading_id"] = $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()) . \Drupal\Component\Utility\Html::getId("-menu");
// line 37
echo "<nav role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, twig_without($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "removeClass", array(0 => "clearfix"), "method"), "role", "aria-labelledby"), "html", null, true));
echo ">\n ";
// line 38
$this->displayBlock('content', $context, $blocks);
// line 41
echo "</nav>\n";
}
开发者ID:evmorfia-b,项目名称:feelmybook,代码行数:31,代码来源:b7b3b956b04270115f4821545d4c1e35075b29666387b6461d3429fdd201e212.php
示例2: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("set" => 10, "trans" => 17);
$filters = array("clean_id" => 10);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'trans'), array('clean_id'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 10
$context["show_anchor"] = "show-" . \Drupal\Component\Utility\Html::getId($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()));
// line 11
$context["hide_anchor"] = "hide-" . \Drupal\Component\Utility\Html::getId($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()));
// line 1
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
开发者ID:Wisertown,项目名称:First_Drupal_project,代码行数:25,代码来源:49aa731099c848d1bfaa2448554f7a3d2a44f3418796c6bcaa2d5422dd4450a0.php
示例3: preRender
/**
* {@inheritdoc}
*/
public function preRender(&$element, $rendering_object)
{
$element += array('#prefix' => '<div class=" ' . implode(' ', $this->getClasses()) . '">', '#suffix' => '</div>', '#tree' => TRUE, '#parents' => array($this->group->group_name), '#default_tab' => '');
if ($this->getSetting('id')) {
$element['#id'] = Html::getId($this->getSetting('id'));
}
// By default tabs don't have titles but you can override it in the theme.
if ($this->getLabel()) {
$element['#title'] = SafeMarkup::checkPlain($this->getLabel());
}
$form_state = new FormState();
if ($this->getSetting('direction') == 'vertical') {
$element += array('#type' => 'vertical_tabs', '#theme_wrappers' => array('vertical_tabs'));
$complete_form = array();
$element = VerticalTabs::processVerticalTabs($element, $form_state, $complete_form);
} else {
$element += array('#type' => 'horizontal_tabs', '#theme_wrappers' => array('horizontal_tabs'));
$on_form = $this->context == 'form';
$element = HorizontalTabs::processHorizontalTabs($element, $form_state, $on_form);
}
// Make sure the group has 1 child. This is needed to succeed at form_pre_render_vertical_tabs().
// Skipping this would force us to move all child groups to this array, making it an un-nestable.
$element['group']['#groups'][$this->group->group_name] = array(0 => array());
$element['group']['#groups'][$this->group->group_name]['#group_exists'] = TRUE;
// Search for a tab that was marked as open. First one wins.
foreach (Element::children($element) as $tab_name) {
if (!empty($element[$tab_name]['#open'])) {
$element[$this->group->group_name . '__active_tab']['#default_value'] = $tab_name;
break;
}
}
}
示例4: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("set" => 38, "if" => 48, "block" => 58, "trans" => 63);
$filters = array("clean_class" => 42, "clean_id" => 45, "without" => 46);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'if', 'block', 'trans'), array('clean_class', 'clean_id', 'without'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 38
$context["classes"] = array(0 => "block", 1 => "block-menu", 2 => "navigation", 3 => "menu--" . \Drupal\Component\Utility\Html::getClass(isset($context["derivative_plugin_id"]) ? $context["derivative_plugin_id"] : null));
// line 45
$context["heading_id"] = $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()) . \Drupal\Component\Utility\Html::getId("-menu");
// line 46
echo "<nav role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, twig_without($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "addClass", array(0 => isset($context["classes"]) ? $context["classes"] : null), "method"), "role", "aria-labelledby"), "html", null, true));
echo ">\n ";
// line 48
echo " ";
if (!$this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label_display", array())) {
// line 49
echo " ";
$context["title_attributes"] = $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "addClass", array(0 => "visually-hidden"), "method");
// line 50
echo " ";
}
// line 51
echo " ";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_prefix"]) ? $context["title_prefix"] : null, "html", null, true));
echo "\n <h2";
// line 52
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "setAttribute", array(0 => "id", 1 => isset($context["heading_id"]) ? $context["heading_id"] : null), "method"), "html", null, true));
echo ">";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label", array()), "html", null, true));
echo "</h2>\n ";
// line 53
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_suffix"]) ? $context["title_suffix"] : null, "html", null, true));
echo "\n\n ";
// line 56
echo " ";
$context["show_anchor"] = "show-" . \Drupal\Component\Utility\Html::getId($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()));
// line 57
echo " ";
$context["hide_anchor"] = "hide-" . \Drupal\Component\Utility\Html::getId($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()));
// line 58
echo " ";
$this->displayBlock('content', $context, $blocks);
}
开发者ID:mu5a5hi,项目名称:testmampdrupal,代码行数:59,代码来源:f7d383545602eba8a5c51b386d4550d2155efc7f0ca259ec9e3ed7566027c296.php
示例5: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$__internal_d5fdbc60c80f6b72247ec473e59d80d9ff42128768881ee08f6810a8c73d62af = $this->env->getExtension("native_profiler");
$__internal_d5fdbc60c80f6b72247ec473e59d80d9ff42128768881ee08f6810a8c73d62af->enter($__internal_d5fdbc60c80f6b72247ec473e59d80d9ff42128768881ee08f6810a8c73d62af_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "core/themes/classy/templates/block/block--system-menu-block.html.twig"));
$tags = array("set" => 35, "if" => 45, "block" => 53);
$filters = array("clean_class" => 39, "clean_id" => 42, "without" => 43);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'if', 'block'), array('clean_class', 'clean_id', 'without'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 35
$context["classes"] = array(0 => "block", 1 => "block-menu", 2 => "navigation", 3 => "menu--" . \Drupal\Component\Utility\Html::getClass(isset($context["derivative_plugin_id"]) ? $context["derivative_plugin_id"] : null));
// line 42
$context["heading_id"] = $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()) . \Drupal\Component\Utility\Html::getId("-menu");
// line 43
echo "<nav role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, twig_without($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "addClass", array(0 => isset($context["classes"]) ? $context["classes"] : null), "method"), "role", "aria-labelledby"), "html", null, true));
echo ">\n ";
// line 45
echo " ";
if (!$this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label_display", array())) {
// line 46
echo " ";
$context["title_attributes"] = $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "addClass", array(0 => "visually-hidden"), "method");
// line 47
echo " ";
}
// line 48
echo " ";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_prefix"]) ? $context["title_prefix"] : null, "html", null, true));
echo "\n <h2";
// line 49
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "setAttribute", array(0 => "id", 1 => isset($context["heading_id"]) ? $context["heading_id"] : null), "method"), "html", null, true));
echo ">";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label", array()), "html", null, true));
echo "</h2>\n ";
// line 50
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_suffix"]) ? $context["title_suffix"] : null, "html", null, true));
echo "\n\n ";
// line 53
echo " ";
$this->displayBlock('content', $context, $blocks);
// line 56
echo "</nav>\n";
$__internal_d5fdbc60c80f6b72247ec473e59d80d9ff42128768881ee08f6810a8c73d62af->leave($__internal_d5fdbc60c80f6b72247ec473e59d80d9ff42128768881ee08f6810a8c73d62af_prof);
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:58,代码来源:d4d698bf3c3b29dab9ecae5b0dbd0ca0c232a63ba653660fc08dddae96674205.php
示例6: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
// line 10
$context["show_anchor"] = "show-" . \Drupal\Component\Utility\Html::getId($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()));
// line 11
$context["hide_anchor"] = "hide-" . \Drupal\Component\Utility\Html::getId($this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()));
// line 1
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
开发者ID:skumararatne,项目名称:d8-theme,代码行数:9,代码来源:1f02b01465dfb0b54e55460dc9dc0cf44be4df099776d3c8140bc9757e65cbfb.php
示例7: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("set" => 44, "if" => 56, "block" => 64);
$filters = array("clean_class" => 47, "clean_id" => 51);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'if', 'block'), array('clean_class', 'clean_id'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 44
$context["classes"] = array(0 => "block", 1 => "block-menu", 2 => "block-menu--" . \Drupal\Component\Utility\Html::getClass(isset($context["derivative_plugin_id"]) ? $context["derivative_plugin_id"] : null), 3 => isset($context["label"]) ? $context["label"] : null ? "has-title" : "");
// line 51
$context["heading_id"] = $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()) . \Drupal\Component\Utility\Html::getId("-menu");
// line 52
echo "<nav";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "addClass", array(0 => isset($context["classes"]) ? $context["classes"] : null), "method"), "html", null, true));
echo " role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\">\n <div class=\"block__inner block-menu__inner\">\n\n ";
// line 56
echo " ";
if (!$this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label_display", array())) {
// line 57
echo " ";
$context["title_attributes"] = $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "addClass", array(0 => "visually-hidden"), "method");
// line 58
echo " ";
}
// line 59
echo "\n ";
// line 60
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_prefix"]) ? $context["title_prefix"] : null, "html", null, true));
echo "\n <h2 id=\"";
// line 61
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "addClass", array(0 => "block__title", 1 => "block-menu__title"), "method"), "html", null, true));
echo "><span>";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label", array()), "html", null, true));
echo "</span></h2>\n ";
// line 62
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_suffix"]) ? $context["title_suffix"] : null, "html", null, true));
echo "\n\n ";
// line 64
$this->displayBlock('content', $context, $blocks);
// line 69
echo "\n </div>\n</nav>\n";
}
开发者ID:neetumorwani,项目名称:blogging,代码行数:57,代码来源:117a9553114d82fadc423fbbaa01d1df2fa121adcf186d43d5c55f7209024a44.php
示例8: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
// line 44
$context["classes"] = array(0 => "block", 1 => "block-menu", 2 => ("block-menu--" . \Drupal\Component\Utility\Html::getClass( // line 47
(isset($context["derivative_plugin_id"]) ? $context["derivative_plugin_id"] : null))), 3 => (( // line 48
(isset($context["label"]) ? $context["label"] : null)) ? ("has-title") : ("")));
// line 51
$context["heading_id"] = ($this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "id", array()) . \Drupal\Component\Utility\Html::getId("-menu"));
// line 52
echo "<nav";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "addClass", array(0 => (isset($context["classes"]) ? $context["classes"] : null)), "method"), "html", null, true);
echo " role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["heading_id"]) ? $context["heading_id"] : null), "html", null, true);
echo "\">
<div class=\"block__inner block-menu__inner\">
";
// line 56
echo " ";
if ( !$this->getAttribute((isset($context["configuration"]) ? $context["configuration"] : null), "label_display", array())) {
// line 57
echo " ";
$context["title_attributes"] = $this->getAttribute((isset($context["title_attributes"]) ? $context["title_attributes"] : null), "addClass", array(0 => "visually-hidden"), "method");
// line 58
echo " ";
}
// line 59
echo "
";
// line 60
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["title_prefix"]) ? $context["title_prefix"] : null), "html", null, true);
echo "
<h2 id=\"";
// line 61
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["heading_id"]) ? $context["heading_id"] : null), "html", null, true);
echo "\"";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["title_attributes"]) ? $context["title_attributes"] : null), "addClass", array(0 => "block__title", 1 => "block-menu__title"), "method"), "html", null, true);
echo "><span>";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["configuration"]) ? $context["configuration"] : null), "label", array()), "html", null, true);
echo "</span></h2>
";
// line 62
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["title_suffix"]) ? $context["title_suffix"] : null), "html", null, true);
echo "
";
// line 65
echo " ";
$this->displayBlock('content', $context, $blocks);
// line 70
echo "
</div>
</nav>
";
}
开发者ID:jno84,项目名称:drupal8,代码行数:55,代码来源:c9e8f07a10f10e1ef2fe41c9baae23e36a6d399dbeb623c80c259beee96b6c17.php
示例9: preRender
/**
* {@inheritdoc}
*/
public function preRender(&$element, $rendering_object)
{
$element += array('#type' => 'field_group_accordion_item', '#collapsed' => $this->getSetting('formatter'), '#description' => $this->getSetting('description'), '#title' => Drupal::translation()->translate($this->getLabel()));
if ($this->getSetting('id')) {
$element['#id'] = Html::getId($this->getSetting('id'));
}
$classes = $this->getClasses();
if (!empty($classes)) {
$element += array('#attributes' => array('class' => $classes));
}
}
示例10: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("set" => 44, "block" => 62);
$filters = array("clean_class" => 46, "clean_id" => 51);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'block'), array('clean_class', 'clean_id'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 44
$context["classes"] = array(0 => "rm-block", 1 => "rm--menu--" . \Drupal\Component\Utility\Html::getClass(isset($context["derivative_plugin_id"]) ? $context["derivative_plugin_id"] : null), 2 => isset($context["label"]) ? $context["label"] : null ? "has-title" : "", 3 => "js-hide");
// line 51
$context["heading_id"] = $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()) . \Drupal\Component\Utility\Html::getId("-menu");
// line 52
echo "<nav";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "addClass", array(0 => isset($context["classes"]) ? $context["classes"] : null), "method"), "html", null, true));
echo " role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\">\n <div class=\"rm-block__inner\">\n ";
// line 54
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_prefix"]) ? $context["title_prefix"] : null, "html", null, true));
echo "\n <div id=\"";
// line 55
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "addClass", array(0 => "rm-toggle"), "method"), "html", null, true));
echo ">\n ";
// line 56
$context["rm_text_state"] = isset($context["label"]) ? $context["label"] : null ? "rm-toggle__label" : "visually-hidden";
// line 57
echo " <button href=\"#rm-content\" class=\"rm-toggle__link un-button\" role='button' aria-controls=\"rm-content\" aria-expanded=\"false\">\n <span class=\"";
// line 58
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["rm_text_state"]) ? $context["rm_text_state"] : null, "html", null, true));
echo "\">";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label", array()), "html", null, true));
echo "</span>\n </button>\n </div>\n ";
// line 61
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_suffix"]) ? $context["title_suffix"] : null, "html", null, true));
echo "\n ";
// line 62
$this->displayBlock('content', $context, $blocks);
// line 67
echo " </div>\n</nav>\n";
}
开发者ID:neetumorwani,项目名称:blogging,代码行数:53,代码来源:326d517fd0ea0216d445169bb70cc270aa3a00f66ed4e5158076d34247f91b20.php
示例11: doDisplay
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array("set" => 34, "if" => 37, "block" => 45);
$filters = array("clean_id" => 34, "without" => 35);
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(array('set', 'if', 'block'), array('clean_id', 'without'), array());
} catch (Twig_Sandbox_SecurityError $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 34
$context["heading_id"] = $this->getAttribute(isset($context["attributes"]) ? $context["attributes"] : null, "id", array()) . \Drupal\Component\Utility\Html::getId("-menu");
// line 35
echo "<nav role=\"navigation\" aria-labelledby=\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["heading_id"]) ? $context["heading_id"] : null, "html", null, true));
echo "\"";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, twig_without(isset($context["attributes"]) ? $context["attributes"] : null, "role", "aria-labelledby"), "html", null, true));
echo ">\n ";
// line 37
echo " ";
if (!$this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label_display", array())) {
// line 38
echo " ";
$context["title_attributes"] = $this->getAttribute(isset($context["title_attributes"]) ? $context["title_attributes"] : null, "addClass", array(0 => "visually-hidden"), "method");
// line 39
echo " ";
}
// line 40
echo " ";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_prefix"]) ? $context["title_prefix"] : null, "html", null, true));
echo "\n <h2";
// line 41
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_attributes"]) ? $context["title_attributes"] : null, "html", null, true));
echo ">";
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute(isset($context["configuration"]) ? $context["configuration"] : null, "label", array()), "html", null, true));
echo "</h2>\n ";
// line 42
echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, isset($context["title_suffix"]) ? $context["title_suffix"] : null, "html", null, true));
echo "\n\n ";
// line 45
echo " ";
$this->displayBlock('content', $context, $blocks);
// line 48
echo "</nav>\n";
}
开发者ID:TomPradat,项目名称:capbusiness,代码行数:53,代码来源:50d83d6ae1ff9b14c3c39a708cc18643594be34a3ff4e4ee0ac4e5087b80e097.php
示例12: preRender
/**
* {@inheritdoc}
*/
public function preRender(&$element)
{
$form_state = new FormState();
$element += array('#type' => 'field_group_accordion', '#effect' => $this->getSetting('effect'));
if ($this->getSetting('id')) {
$element['#id'] = Html::getId($this->getSetting('id'));
}
$classes = $this->getClasses();
if (!empty($classes)) {
$element += array('#attributes' => array('class' => $classes));
}
\Drupal\field_group\Element\Accordion::processAccordion($element, $form_state);
}
示例13: preRender
/**
* {@inheritdoc}
*/
public function preRender(&$element)
{
$element += array('#type' => 'details', '#title' => SafeMarkup::checkPlain($this->t($this->getLabel())), '#open' => $this->getSetting('open'));
if ($this->getSetting('id')) {
$element['#id'] = Html::getId($this->getSetting('id'));
}
if ($this->getSetting('classes')) {
$element += array('#attributes' => array('class' => explode(' ', $this->getSetting('classes'))));
}
if ($this->getSetting('description')) {
$element += array('#description' => $this->getSetting('description'));
}
}
示例14: preRender
/**
* {@inheritdoc}
*/
public function preRender(&$element, $rendering_object)
{
$element += array('#type' => 'details', '#title' => SafeMarkup::checkPlain($this->t($this->getLabel())), '#open' => $this->getSetting('open'));
if ($this->getSetting('id')) {
$element['#id'] = Html::getId($this->getSetting('id'));
}
$classes = $this->getClasses();
if (!empty($classes)) {
$element += array('#attributes' => array('class' => $classes));
}
if ($this->getSetting('description')) {
$element += array('#description' => $this->getSetting('description'));
}
}
示例15: form
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state)
{
$form = parent::form($form, $form_state);
$menu_links_elements = $this->getMenuLinkElements($this->entity->getTargetMenu());
$layout_options = $this->getLayoutOptions();
$table_header = ['label' => $this->t('Label'), 'category' => $this->t('Category'), 'region' => $this->t('Region'), 'weight' => $this->t('Weight'), 'operations' => $this->t('Operations')];
$form['links'] = ['#type' => 'container', '#title' => $this->t('Menu links'), '#tree' => TRUE];
$blocks = $this->entity->getAllBlocksSortedByLink();
foreach ($menu_links_elements as $link_element_id => $link_element) {
// Replace any dots with a underscore since dots are not supported as
// keys in the configuration data.
$link_element_id = str_replace('.', '_', $link_element_id);
$link_layout = $this->entity->getLinkLayout($link_element_id);
$regions = $this->getLayoutRegions($link_layout);
$link_id = Html::getId($link_element_id);
$form['links'][$link_element_id] = ['#type' => 'fieldset', '#title' => $link_element->link->getTitle()];
$form['links'][$link_element_id]['layout'] = ['#type' => 'select', '#title' => $this->t('Layout'), '#options' => $layout_options, '#default_value' => $link_layout, '#ajax' => ['callback' => '::onLayoutSelect', 'wrapper' => "mega-menu-link-{$link_id}-blocks-wrapper"], '#attributes' => ['data-link-element-id' => $link_element_id]];
$form['links'][$link_element_id]['blocks'] = ['#prefix' => '<div id="mega-menu-link-' . $link_id . '-blocks-wrapper">', '#suffix' => '</div>', '#type' => 'table', '#header' => $table_header, '#empty' => $this->t('There are no regions for blocks.')];
// Add regions.
foreach ($regions as $region_key => $region_name) {
// Tabledrag stuff.
$form['links'][$link_element_id]['blocks']['#tabledrag'][] = ['action' => 'match', 'relationship' => 'sibling', 'group' => 'block-region-select', 'subgroup' => 'block-region-' . $region_key, 'hidden' => FALSE];
$form['links'][$link_element_id]['blocks']['#tabledrag'][] = ['action' => 'order', 'relationship' => 'sibling', 'group' => 'block-weight', 'subgroup' => 'block-weight-' . $region_key];
// Regions.
$form['links'][$link_element_id]['blocks'][$region_key] = ['#attributes' => ['class' => ['region-title', 'region-title-' . $region_key], 'no_striping' => TRUE]];
if ($region_key === MegaMenuInterface::NO_REGION) {
$form['links'][$link_element_id]['blocks'][$region_key]['title'] = ['#markup' => $region_name, '#wrapper_attributes' => ['colspan' => 5]];
} else {
$form['links'][$link_element_id]['blocks'][$region_key]['title'] = ['#theme_wrappers' => ['container' => ['#attributes' => ['class' => ['region-title__action']]]], '#prefix' => $region_name, '#type' => 'link', '#title' => $this->t('Place block <span class="visually-hidden">in the %region region</span>', ['%region' => $region_name]), '#url' => Url::fromRoute('mega_menu.block_library', ['mega_menu' => $this->entity->id()], ['query' => ['link' => $link_element_id, 'region' => $region_key]]), '#wrapper_attributes' => ['colspan' => 5], '#attributes' => ['class' => ['use-ajax', 'button', 'button--small'], 'data-dialog-type' => 'modal', 'data-dialog-options' => Json::encode(['width' => 700])]];
}
$blocks_by_region = isset($blocks[$link_element_id]) ? $blocks[$link_element_id]->getAllByRegion() : [];
$region_message_class = empty($blocks_by_region[$region_key]) ? 'region-empty' : 'region-populated';
$form['links'][$link_element_id]['blocks'][$region_key . '-message'] = ['#attributes' => ['class' => ['region-message', 'region-' . $region_key . '-message', $region_message_class]]];
$form['links'][$link_element_id]['blocks'][$region_key . '-message']['message'] = ['#markup' => '<em>' . $this->t('No blocks in this region') . '</em>', '#wrapper_attributes' => ['colspan' => 5]];
if (!isset($blocks_by_region[$region_key])) {
continue;
}
/** @var BlockPluginInterface $block */
foreach ($blocks_by_region[$region_key] as $block_id => $block) {
if (!isset($form['links'][$link_element_id])) {
continue;
}
$operations = ['edit' => ['title' => $this->t('Edit'), 'url' => Url::fromRoute('mega_menu.block_edit', ['mega_menu' => $this->entity->id(), 'block_id' => $block_id], ['query' => ['link' => $link_element_id, 'region' => $region_key]]), 'attributes' => ['class' => ['use-ajax', 'button', 'button--small'], 'data-dialog-type' => 'modal', 'data-dialog-options' => Json::encode(['width' => 700])]], 'delete' => ['title' => $this->t('Delete'), 'url' => Url::fromRoute('mega_menu.block_delete', ['mega_menu' => $this->entity->id(), 'block_id' => $block_id], ['query' => ['link' => $link_element_id]]), 'attributes' => ['class' => ['use-ajax', 'button', 'button--small'], 'data-dialog-type' => 'modal', 'data-dialog-options' => Json::encode(['width' => 700])]]];
$configuration = $block->getConfiguration();
$form['links'][$link_element_id]['blocks'][$block_id] = ['#attributes' => ['class' => ['draggable']], 'label' => ['#markup' => $block->label()], 'category' => ['#markup' => $block->getPluginDefinition()['category']], 'region' => ['#type' => 'select', '#title' => $this->t('Region for @block block', ['@block' => $block->label()]), '#title_display' => 'invisible', '#default_value' => $region_key, '#options' => $regions, '#attributes' => ['class' => ['block-region-select', 'block-region-' . $region_key]]], 'weight' => ['#type' => 'weight', '#default_value' => isset($configuration['weight']) ? $configuration['weight'] : 0, '#title' => $this->t('Weight for @block block', ['@block' => $block->label()]), '#title_display' => 'invisible', '#attributes' => ['class' => ['block-weight', 'block-weight-' . $configuration['region']]]], 'operations' => ['#type' => 'operations', '#links' => $operations]];
}
}
}
return $form;
}