本文整理汇总了PHP中aTools::getRealPage方法的典型用法代码示例。如果您正苦于以下问题:PHP aTools::getRealPage方法的具体用法?PHP aTools::getRealPage怎么用?PHP aTools::getRealPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aTools
的用法示例。
在下文中一共展示了aTools::getRealPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url_for
<?php
// Make sure we target the administrative media engine page and not a public instance
aRouteTools::pushTargetEnginePage('/admin/media');
$after = url_for($action) . "?" . http_build_query(array("slot" => $name, "slug" => $slug, "actual_slug" => aTools::getRealPage()->getSlug(), "permid" => $permid, "noajax" => 1));
echo link_to($buttonLabel, 'aMedia/select', array('query_string' => http_build_query(array_merge($constraints, array("aMediaId" => $itemId, "type" => $type, "label" => $label, "after" => $after))), 'class' => $class));
aRouteTools::popTargetEnginePage('aMedia');
示例2: setup
protected function setup()
{
if (!isset($this->options)) {
// Prevents numerous warnings and problems if there are no slot options present
$this->options = array();
}
$this->page = aTools::getCurrentPage();
$this->slug = $this->page->slug;
// TODO: remove this workaround in 1.5. All uses of actual_slug and real-slug need to go away
// in favor of actual_url, we just don't want to break any old overrides in client projects.
$this->realSlug = aTools::getRealPage() ? aTools::getRealPage()->getSlug() : 'global';
$this->slot = $this->page->getSlot($this->name, $this->permid);
if (!$this->slot || $this->slot->type !== $this->type) {
$this->slot = $this->page->createSlot($this->type);
}
if ($this->getOption('edit')) {
$this->editable = true;
} else {
if (aTools::getAllowSlotEditing()) {
$this->editable = $this->page->userHasPrivilege('edit');
} else {
$this->editable = false;
}
}
if ($this->getOption('preview')) {
$this->editable = false;
}
if ($this->editable) {
$user = $this->getUser();
$id = $this->page->getId();
$name = $this->name;
$permid = $this->permid;
// Make sure the options passed to a_slot
// can be found again at save time
if (!$this->updating) {
// Slot options can be influenced by variant switching, and that's fine, and the editor might
// need to know about it to do the right thing, so it's appropriate to reset the slot
// options in the attribute. However, we also need to know what the original, pristine
// options from a_slot or a_area were in order to allow variants to be switched without
// having side effects on each other's option sets
$user->setAttribute("slot-original-options-{$id}-{$name}-{$permid}", $this->options, 'apostrophe');
// Refactored to get rid of duplicate logic
$allowedVariants = array_keys(aTools::getVariantsForSlotType($this->type, $this->options));
$user->setAttribute("slot-allowed-variants-{$id}-{$name}-{$permid}", $allowedVariants, 'apostrophe');
}
$user->setAttribute("slot-options-{$id}-{$name}-{$permid}", $this->options, 'apostrophe');
}
// Calling getEffectiveVariant ensures we default to the behavior of the first one
// defined, or the first one allowed if there is an allowed_variants option
$variant = $this->slot->getEffectiveVariant($this->options);
if ($variant) {
// Allow slot variants to adjust slot options. This shouldn't be used to radically
// change the slot, just as an adjunct to CSS, styling things in ways CSS can't
$variants = aTools::getVariantsForSlotType($this->slot->type, $this->options);
if (isset($variants[$variant]['options'])) {
$options = $variants[$variant]['options'];
$this->options = array_merge($this->options, $options);
}
}
$this->pageid = $this->page->id;
$this->id = $this->pageid . '-' . $this->name . '-' . $this->permid;
// The basic slot types, and some custom slot types, are
// simplified by having this field ready to go
$this->value = $this->slot->value;
// Not everyone wants the default 'double click the outline to
// start editing' behavior
$this->outlineEditable = $this->editable && $this->getOption('outline_editable', $this->slot->isOutlineEditable());
// Useful if you're reimplementing that via a button etc
$id = $this->id;
$this->showEditorJS = "\$('#content-{$id}').hide(); \$('#form-{$id}').fadeIn();";
if (isset($this->validationData['form'])) {
// Make Symfony 1.2 form validation extra-convenient
$this->form = $this->validationData['form'];
}
}
示例3: slot
<?php
// points to our slot's edit action. Setting the ajax parameter
?>
<?php
// to false causes the edit action to redirect to the newly
?>
<?php
// updated page.
?>
<?php
slot("a-slot-controls-{$pageid}-{$name}-{$permid}");
?>
<li class="a-controls-item choose-images">
<?php
echo link_to(__('Choose images', null, 'apostrophe'), 'aMedia/select', array('query_string' => http_build_query(array_merge($options['constraints'], array("multiple" => true, "aMediaIds" => implode(",", $itemIds), "type" => "image", "label" => __("Create a Slideshow", null, 'apostrophe'), "after" => url_for("aSlideshowSlot/edit") . "?" . http_build_query(array("slot" => $name, "slug" => $slug, "permid" => $permid, "actual_slug" => aTools::getRealPage()->getSlug(), 'actual_url' => aTools::getRealUrl(), "noajax" => 1))))), 'class' => 'a-btn icon a-media'));
?>
</li>
<?php
include_partial('a/variant', array('pageid' => $pageid, 'name' => $name, 'permid' => $permid, 'slot' => $slot));
?>
<?php
end_slot();
?>
<?php
}
?>