本文整理汇总了PHP中views_ui_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP views_ui_truncate函数的具体用法?PHP views_ui_truncate怎么用?PHP views_ui_truncate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了views_ui_truncate函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testWizardFieldLength
/**
* Tests filling in the wizard with really long strings.
*/
public function testWizardFieldLength()
{
$view = array();
$view['label'] = $this->randomMachineName(256);
$view['id'] = strtolower($this->randomMachineName(129));
$view['page[create]'] = TRUE;
$view['page[path]'] = $this->randomMachineName(255);
$view['page[title]'] = $this->randomMachineName(256);
$view['page[feed]'] = TRUE;
$view['page[feed_properties][path]'] = $this->randomMachineName(255);
$view['block[create]'] = TRUE;
$view['block[title]'] = $this->randomMachineName(256);
$this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
$this->assertText('Machine-readable name cannot be longer than 128 characters but is currently 129 characters long.');
$this->assertText('Path cannot be longer than 254 characters but is currently 255 characters long.');
$this->assertText('Page title cannot be longer than 255 characters but is currently 256 characters long.');
$this->assertText('View name cannot be longer than 255 characters but is currently 256 characters long.');
$this->assertText('Feed path cannot be longer than 254 characters but is currently 255 characters long.');
$this->assertText('Block title cannot be longer than 255 characters but is currently 256 characters long.');
$view['label'] = $this->randomMachineName(255);
$view['id'] = strtolower($this->randomMachineName(128));
$view['page[create]'] = TRUE;
$view['page[path]'] = $this->randomMachineName(254);
$view['page[title]'] = $this->randomMachineName(255);
$view['page[feed]'] = TRUE;
$view['page[feed_properties][path]'] = $this->randomMachineName(254);
$view['block[create]'] = TRUE;
$view['block[title]'] = $this->randomMachineName(255);
$this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
$this->assertUrl('admin/structure/views/view/' . $view['id'], array(), 'Make sure the view saving was successful and the browser got redirected to the edit page.');
// Assert that the page title is correctly truncated.
$this->assertText(views_ui_truncate($view['page[title]'], 32));
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:36,代码来源:WizardTest.php
示例2: optionsSummary
/**
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options)
{
parent::optionsSummary($categories, $options);
$categories['display_test'] = array('title' => $this->t('Display test settings'), 'column' => 'second', 'build' => array('#weight' => -100));
$test_option = $this->getOption('test_option') ?: $this->t('Empty');
$options['test_option'] = array('category' => 'display_test', 'title' => $this->t('Test option'), 'value' => views_ui_truncate($test_option, 24));
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:DisplayTest.php
示例3: optionsSummary
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
*/
public function optionsSummary(&$categories, &$options)
{
parent::optionsSummary($categories, $options);
$menu = $this->getOption('menu');
if (!is_array($menu)) {
$menu = array('type' => 'none');
}
switch ($menu['type']) {
case 'none':
default:
$menu_str = $this->t('No menu');
break;
case 'normal':
$menu_str = $this->t('Normal: @title', array('@title' => $menu['title']));
break;
case 'tab':
case 'default tab':
$menu_str = $this->t('Tab: @title', array('@title' => $menu['title']));
break;
}
$options['menu'] = array('category' => 'page', 'title' => $this->t('Menu'), 'value' => views_ui_truncate($menu_str, 24));
// This adds a 'Settings' link to the style_options setting if the style
// has options.
if ($menu['type'] == 'default tab') {
$options['menu']['setting'] = $this->t('Parent menu item');
$options['menu']['links']['tab_options'] = $this->t('Change settings for the parent menu');
}
}
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:31,代码来源:Page.php
示例4: optionsSummary
/**
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options)
{
$categories = array('title' => array('title' => $this->t('Title'), 'column' => 'first'), 'format' => array('title' => $this->t('Format'), 'column' => 'first'), 'filters' => array('title' => $this->t('Filters'), 'column' => 'first'), 'fields' => array('title' => $this->t('Fields'), 'column' => 'first'), 'pager' => array('title' => $this->t('Pager'), 'column' => 'second'), 'language' => array('title' => $this->t('Language'), 'column' => 'second'), 'exposed' => array('title' => $this->t('Exposed form'), 'column' => 'third', 'build' => array('#weight' => 1)), 'access' => array('title' => '', 'column' => 'second', 'build' => array('#weight' => -5)), 'other' => array('title' => $this->t('Other'), 'column' => 'third', 'build' => array('#weight' => 2)));
if ($this->display['id'] != 'default') {
$options['display_id'] = array('category' => 'other', 'title' => $this->t('Machine Name'), 'value' => !empty($this->display['new_id']) ? $this->display['new_id'] : $this->display['id'], 'desc' => $this->t('Change the machine name of this display.'));
}
$display_comment = views_ui_truncate($this->getOption('display_comment'), 80);
$options['display_comment'] = array('category' => 'other', 'title' => $this->t('Administrative comment'), 'value' => !empty($display_comment) ? $display_comment : $this->t('None'), 'desc' => $this->t('Comment or document this display.'));
$title = strip_tags($this->getOption('title'));
if (!$title) {
$title = $this->t('None');
}
$options['title'] = array('category' => 'title', 'title' => $this->t('Title'), 'value' => views_ui_truncate($title, 32), 'desc' => $this->t('Change the title that this display will use.'));
$style_plugin_instance = $this->getPlugin('style');
$style_summary = empty($style_plugin_instance->definition['title']) ? $this->t('Missing style plugin') : $style_plugin_instance->summaryTitle();
$style_title = empty($style_plugin_instance->definition['title']) ? $this->t('Missing style plugin') : $style_plugin_instance->pluginTitle();
$options['style'] = array('category' => 'format', 'title' => $this->t('Format'), 'value' => $style_title, 'setting' => $style_summary, 'desc' => $this->t('Change the way content is formatted.'));
// This adds a 'Settings' link to the style_options setting if the style has
// options.
if ($style_plugin_instance->usesOptions()) {
$options['style']['links']['style_options'] = $this->t('Change settings for this format');
}
if ($style_plugin_instance->usesRowPlugin()) {
$row_plugin_instance = $this->getPlugin('row');
$row_summary = empty($row_plugin_instance->definition['title']) ? $this->t('Missing row plugin') : $row_plugin_instance->summaryTitle();
$row_title = empty($row_plugin_instance->definition['title']) ? $this->t('Missing row plugin') : $row_plugin_instance->pluginTitle();
$options['row'] = array('category' => 'format', 'title' => $this->t('Show'), 'value' => $row_title, 'setting' => $row_summary, 'desc' => $this->t('Change the way each row in the view is styled.'));
// This adds a 'Settings' link to the row_options setting if the row style
// has options.
if ($row_plugin_instance->usesOptions()) {
$options['row']['links']['row_options'] = $this->t('Change settings for this style');
}
}
if ($this->usesAJAX()) {
$options['use_ajax'] = array('category' => 'other', 'title' => $this->t('Use AJAX'), 'value' => $this->getOption('use_ajax') ? $this->t('Yes') : $this->t('No'), 'desc' => $this->t('Change whether or not this display will use AJAX.'));
}
if ($this->usesAttachments()) {
$options['hide_attachment_summary'] = array('category' => 'other', 'title' => $this->t('Hide attachments in summary'), 'value' => $this->getOption('hide_attachment_summary') ? $this->t('Yes') : $this->t('No'), 'desc' => $this->t('Change whether or not to display attachments when displaying a contextual filter summary.'));
}
if (!isset($this->definition['contextual links locations']) || !empty($this->definition['contextual links locations'])) {
$options['show_admin_links'] = array('category' => 'other', 'title' => $this->t('Contextual links'), 'value' => $this->getOption('show_admin_links') ? $this->t('Shown') : $this->t('Hidden'), 'desc' => $this->t('Change whether or not to display contextual links for this view.'));
}
$pager_plugin = $this->getPlugin('pager');
if (!$pager_plugin) {
// Default to the no pager plugin.
$pager_plugin = Views::pluginManager('pager')->createInstance('none');
}
$pager_str = $pager_plugin->summaryTitle();
$options['pager'] = array('category' => 'pager', 'title' => $this->t('Use pager'), 'value' => $pager_plugin->pluginTitle(), 'setting' => $pager_str, 'desc' => $this->t("Change this display's pager setting."));
// If pagers aren't allowed, change the text of the item.
if (!$this->usesPager()) {
$options['pager']['title'] = $this->t('Items to display');
}
if ($pager_plugin->usesOptions()) {
$options['pager']['links']['pager_options'] = $this->t('Change settings for this pager type.');
}
if ($this->usesMore()) {
$options['use_more'] = array('category' => 'pager', 'title' => $this->t('More link'), 'value' => $this->getOption('use_more') ? $this->t('Yes') : $this->t('No'), 'desc' => $this->t('Specify whether this display will provide a "more" link.'));
}
$this->view->initQuery();
if ($this->view->query->getAggregationInfo()) {
$options['group_by'] = array('category' => 'other', 'title' => $this->t('Use aggregation'), 'value' => $this->getOption('group_by') ? $this->t('Yes') : $this->t('No'), 'desc' => $this->t('Allow grouping and aggregation (calculation) of fields.'));
}
$options['query'] = array('category' => 'other', 'title' => $this->t('Query settings'), 'value' => $this->t('Settings'), 'desc' => $this->t('Allow to set some advanced settings for the query plugin'));
if (\Drupal::languageManager()->isMultilingual() && $this->isBaseTableTranslatable()) {
$rendering_language_options = $this->buildRenderingLanguageOptions();
$options['rendering_language'] = array('category' => 'language', 'title' => $this->t('Rendering Language'), 'value' => $rendering_language_options[$this->getOption('rendering_language')], 'desc' => $this->t('All content that supports translations will be displayed in the selected language.'));
}
$access_plugin = $this->getPlugin('access');
if (!$access_plugin) {
// Default to the no access control plugin.
$access_plugin = Views::pluginManager('access')->createInstance('none');
}
$access_str = $access_plugin->summaryTitle();
$options['access'] = array('category' => 'access', 'title' => $this->t('Access'), 'value' => $access_plugin->pluginTitle(), 'setting' => $access_str, 'desc' => $this->t('Specify access control type for this display.'));
if ($access_plugin->usesOptions()) {
$options['access']['links']['access_options'] = $this->t('Change settings for this access type.');
}
$cache_plugin = $this->getPlugin('cache');
if (!$cache_plugin) {
// Default to the no cache control plugin.
$cache_plugin = Views::pluginManager('cache')->createInstance('none');
}
$cache_str = $cache_plugin->summaryTitle();
$options['cache'] = array('category' => 'other', 'title' => $this->t('Caching'), 'value' => $cache_plugin->pluginTitle(), 'setting' => $cache_str, 'desc' => $this->t('Specify caching type for this display.'));
if ($cache_plugin->usesOptions()) {
$options['cache']['links']['cache_options'] = $this->t('Change settings for this caching type.');
}
if ($access_plugin->usesOptions()) {
$options['access']['links']['access_options'] = $this->t('Change settings for this access type.');
}
if ($this->usesLinkDisplay()) {
$link_display_option = $this->getOption('link_display');
$link_display = $this->t('None');
if ($link_display_option == 'custom_url') {
$link_display = $this->t('Custom URL');
} elseif (!empty($link_display_option)) {
//.........这里部分代码省略.........
开发者ID:318io,项目名称:318-io,代码行数:101,代码来源:DisplayPluginBase.php
示例5: optionsSummary
/**
* Provide the summary for page options in the views UI.
*
* This output is returned as an array.
*/
public function optionsSummary(&$categories, &$options)
{
parent::optionsSummary($categories, $options);
$categories['block'] = array('title' => $this->t('Block settings'), 'column' => 'second', 'build' => array('#weight' => -10));
$block_description = strip_tags($this->getOption('block_description'));
if (empty($block_description)) {
$block_description = $this->t('None');
}
$block_category = $this->getOption('block_category');
$options['block_description'] = array('category' => 'block', 'title' => $this->t('Block name'), 'value' => views_ui_truncate($block_description, 24));
$options['block_category'] = array('category' => 'block', 'title' => $this->t('Block category'), 'value' => views_ui_truncate($block_category, 24));
$filtered_allow = array_filter($this->getOption('allow'));
$options['allow'] = array('category' => 'block', 'title' => $this->t('Allow settings'), 'value' => empty($filtered_allow) ? $this->t('None') : $this->t('Items per page'));
$options['block_hide_empty'] = array('category' => 'other', 'title' => $this->t('Hide block if the view output is empty'), 'value' => $this->getOption('block_hide_empty') ? $this->t('Yes') : $this->t('No'));
}
开发者ID:ravibarnwal,项目名称:laraitassociate.in,代码行数:20,代码来源:Block.php
示例6: optionsSummary
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
*/
public function optionsSummary(&$categories, &$options)
{
parent::optionsSummary($categories, $options);
$categories['page'] = array('title' => $this->t('Page settings'), 'column' => 'second', 'build' => array('#weight' => -10));
$path = strip_tags($this->getOption('path'));
if (empty($path)) {
$path = $this->t('No path is set');
} else {
$path = '/' . $path;
}
$options['path'] = array('category' => 'page', 'title' => $this->t('Path'), 'value' => views_ui_truncate($path, 24));
}
开发者ID:HakS,项目名称:drupal8_training,代码行数:15,代码来源:PathPluginBase.php
示例7: getDisplayLabel
/**
* Placeholder function for overriding $display['display_title'].
*
* @todo Remove this function once editing the display title is possible.
*/
public function getDisplayLabel(ViewUI $view, $display_id, $check_changed = TRUE)
{
$display = $view->get('display');
$title = $display_id == 'default' ? $this->t('Master') : $display[$display_id]['display_title'];
$title = views_ui_truncate($title, 25);
if ($check_changed && !empty($view->changed_display[$display_id])) {
$changed = '*';
$title = $title . $changed;
}
return $title;
}
开发者ID:nstielau,项目名称:drops-8,代码行数:16,代码来源:ViewFormBase.php
示例8: testDisplayTitleInButtonsXss
/**
* Ensures that no XSS is possible for buttons.
*/
public function testDisplayTitleInButtonsXss()
{
$xss_markup = '"><script>alert(123)</script>';
$view = $this->randomView();
$view = View::load($view['id']);
\Drupal::configFactory()->getEditable('views.settings')->set('ui.show.master_display', TRUE)->save();
foreach ([$xss_markup, '"><script>alert(123)</script>'] as $input) {
$display =& $view->getDisplay('page_1');
$display['display_title'] = $input;
$view->save();
$this->drupalGet("admin/structure/views/view/{$view->id()}");
$escaped = views_ui_truncate($input, 25);
$this->assertEscaped($escaped);
$this->assertNoRaw($xss_markup);
$this->drupalGet("admin/structure/views/view/{$view->id()}/edit/page_1");
$this->assertEscaped("View {$escaped}");
$this->assertNoRaw("View {$xss_markup}");
$this->assertEscaped("Duplicate {$escaped}");
$this->assertNoRaw("Duplicate {$xss_markup}");
$this->assertEscaped("Delete {$escaped}");
$this->assertNoRaw("Delete {$xss_markup}");
}
}
开发者ID:ddrozdik,项目名称:dmaps,代码行数:26,代码来源:DisplayTest.php
示例9: optionsSummary
/**
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options)
{
parent::optionsSummary($categories, $options);
// Authentication.
$auth = $this->getOption('auth') ? implode(', ', $this->getOption('auth')) : $this->t('No authentication is set');
unset($categories['page'], $categories['exposed']);
// Hide some settings, as they aren't useful for pure data output.
unset($options['show_admin_links'], $options['analyze-theme']);
$categories['path'] = array('title' => $this->t('Path settings'), 'column' => 'second', 'build' => array('#weight' => -10));
$options['path']['category'] = 'path';
$options['path']['title'] = $this->t('Path');
$options['auth'] = array('category' => 'path', 'title' => $this->t('Authentication'), 'value' => views_ui_truncate($auth, 24));
// Remove css/exposed form settings, as they are not used for the data
// display.
unset($options['exposed_form']);
unset($options['exposed_block']);
unset($options['css_class']);
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:21,代码来源:RestExport.php
注:本文中的views_ui_truncate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论