本文整理汇总了PHP中XLite\View\AView::modifyResourcePath方法的典型用法代码示例。如果您正苦于以下问题:PHP AView::modifyResourcePath方法的具体用法?PHP AView::modifyResourcePath怎么用?PHP AView::modifyResourcePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\View\AView
的用法示例。
在下文中一共展示了AView::modifyResourcePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSettingsFieldset
/**
* Add "LC widget settings" fieldset for the form
*
* :FIXME: to revize
*
* @param array &$form Form description
* @param string $class LC widget class
* @param string $label Widget class readable name
* @param array $block Block description OPTIONAL
* @param array $formInput Form input OPTIONAL
*
* @return void
*/
protected function addSettingsFieldset(array &$form, $class, $label, array $block = array(), array $formInput = array())
{
// Get settings from LC
$widget = $this->getHandler()->getWidget($class);
if (isset($block['options']) && is_array($block['options'])) {
$widget->setWidgetParams($block['options']);
}
// To prevent some unpredictable errors related to backslashes in element IDs
$key = $this->getBlockName($class);
if ($formInput && isset($formInput['lc_widget']) && isset($formInput['lc_widget'][$key])) {
$widget->setWidgetParams($formInput['lc_widget'][$key]);
}
$settings = $widget->getWidgetSettings();
if ($settings) {
$form[$key] = array('#type' => 'fieldset', '#title' => 'Parameters', '#attributes' => array('id' => $key));
$extendedItemsList = is_subclass_of($widget->getProtectedWidget(), 'XLite\\View\\ItemsList\\Product\\Customer\\ACustomer');
// Translate native LC options into Drupal format
foreach ($settings as $name => $param) {
$form[$key][$name] = array('#type' => $this->fieldTypesTranslationTable[$param->type], '#title' => t($param->label), '#default_value' => isset($block['options'][$name]) ? $block['options'][$name] : $param->value);
$extendedAttributes = array(\XLite\View\ItemsList\Product\Customer\ACustomer::PARAM_ICON_MAX_WIDTH, \XLite\View\ItemsList\Product\Customer\ACustomer::PARAM_ICON_MAX_HEIGHT);
if ('select' === $form[$key][$name]['#type']) {
$form[$key][$name]['#options'] = $param->options;
} elseif ($extendedItemsList && in_array($name, $extendedAttributes)) {
$form[$key][$name]['#description'] = t('recommended: !size', array('!size' => 110));
}
}
if ($extendedItemsList) {
if (!isset($form['#attached'])) {
$form['#attached'] = array('js' => array());
} elseif (!isset($form['#attached']['js'])) {
$form['#attached']['js'] = array();
}
$path = \XLite\Core\Layout::getInstance()->getResourceFullPath('modules/CDev/DrupalConnector/blocks.js', \XLite::CUSTOMER_INTERFACE);
$form['#attached']['js'][] = \XLite\View\AView::modifyResourcePath($path);
// Display modes data
$jsData = array(\XLite\View\ItemsList\Product\Customer\ACustomer::WIDGET_TYPE_SIDEBAR => \XLite\View\ItemsList\Product\Customer\ACustomer::getSidebarDisplayModes(), \XLite\View\ItemsList\Product\Customer\ACustomer::WIDGET_TYPE_CENTER => \XLite\View\ItemsList\Product\Customer\ACustomer::getCenterDisplayModes());
drupal_add_js('lcConnectorBlocks.' . $key . ' = ' . json_encode($jsData) . ';', 'inline');
// Recommended icons sizes
$jsData = \XLite\View\ItemsList\Product\Customer\ACustomer::getIconSizes();
$lbl = t('recommended: !size');
drupal_add_js('lcConnectorRecommendedIconSizes.' . $key . ' = ' . json_encode($jsData) . ';' . PHP_EOL . 'var lcConnectorRecommendedLabel = \'' . $lbl . '\';', 'inline');
}
}
}