includes/common.inc, строка 1544
- 5
l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE)
- 6
l($text, $path, $options = array())
Оформляет ссылки. Эта функция корректно работает с синонимами путей, а также позволяет темам корректно подсвечивать ссылки на текущую страницу, поэтому все ссылки, по возможности, должны генерироваться этой функцией.
Параметры
$text
Текст ссылки.
$path
Путь, на который ссылаемся (например, 'admin/content/node'
). Конечная ссылка генерируется с помощью url()
, поэтому путь может быть как внутренней ссылкой, так и внешним URL-ом:
- Если подается полный URL, будет создана внешняя ссылка.
- Если подается только путь (т.е.
'admin/content/node'
), создается внутренняя ссылка (без 'http://'
). Подаваемый путь может быть как внутренним путем Друпала (т.е. 'node/123'
), так и синонимом.
'<front>'
преобразуется в ссылку на главную страницу сайта.
- Если вы подаете путь и опция
'alias'
равна TRUE
(см. ниже), путь вставляется как есть.
$options
Ассоциативный массив дополнительных опций со следующими ключами:
'attributes'
Ассоциативный массив HTML атрибутов тега ссылки.
'query'
GET параметры ссылки строкой (без '?'
), либо массивом вида ключ
/значение
.
'fragment'
Якорный фрагмент ссылки (то, что идет после '#'
).
'absolute'
(по-умолчанию FALSE
)
Принудительное создание внешней ссылки (начинается с 'http://'
) (полезно, если вы создаете ссылку, которая будет показываться вне сайта (например, в RSS ленте)).
'html'
(по-умолчанию FALSE
)
Присутствует ли HTML в тексте ссылки. Например, если вы хотите вставить в ссылку рисунок, эту опцию следует установить в TRUE
, иначе HTML в тексте отфильтруется (см. check_plain()
).
'alias'
(по-умолчанию FALSE
)
Определяет является ли подаваемый путь синонимом (полезно, если подаваемый синоним эквивалентен внутреннему пути Друпала, что убережет от загрузки синонима к этому внутреннуму пути).
Возвращаемое значение
HTML код ссылки.
Format an internal Drupal link.
This function correctly handles aliased paths, and allows themes to highlight
links to the current page correctly, so all internal links output by modules
should be generated by this function if possible.
Parameters
$text
The text to be enclosed with the anchor tag.
$path
The Drupal path being linked to, such as "admin/content/node". Can be an
external or internal URL.
- If you provide the full URL, it will be considered an external URL.
- If you provide only the path (e.g. "admin/content/node"), it is
considered an internal link. In this case, it must be a system URL
as the url() function will generate the alias.
- If you provide '<front>', it generates a link to the site's
base URL (again via the url() function).
- If you provide a path, and 'alias' is set to TRUE (see below), it is
used as is.
$options
An associative array of additional options, with the following keys:
- 'attributes'
An associative array of HTML attributes to apply to the anchor tag.
- 'query'
A query string to append to the link, or an array of query key/value
properties.
- 'fragment'
A fragment identifier (named anchor) to append to the link.
Do not include the '#' character.
- 'absolute' (default FALSE)
Whether to force the output to be an absolute link (beginning with
http:). Useful for links that will be displayed outside the site, such
as in an RSS feed.
- 'html' (default FALSE)
Whether the title is HTML, or just plain-text. For example for making
an image a link, this must be set to TRUE, or else you will see the
escaped HTML.
- 'alias' (default FALSE)
Whether the given path is an alias already.
Return value
an HTML string containing a link to the given path.
- actions_synchronize in includes/actions.inc
- Синхронизирует действия, переданные из модуля.
- aggregator_form_category_submit in modules/aggregator/aggregator.admin.inc
- Process aggregator_form_category form submissions.
- aggregator_form_feed_submit in modules/aggregator/aggregator.admin.inc
- Process aggregator_form_feed form submissions.
- aggregator_view in modules/aggregator/aggregator.admin.inc
- Отображает страницу администрирования агрегатора.
- block_admin_display_form in modules/block/block.admin.inc
- Generate main blocks administration form.
- blogapi_blogger_edit_post in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Модифицирует указанную ноду блога.
- blogapi_blogger_new_post in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Вставляет новую запись блога как ноду.
- blog_form in modules/blog/blog.module
- Реализация hook_form().
- blog_page_last in modules/blog/blog.pages.inc
- Коллбэк меню. Показывает страницу Друпал с последними записями в блогах пользователей.
- blog_page_user in modules/blog/blog.pages.inc
- Коллбэк меню. Показывает страницу Друпал с последними записями в блоге данного пользователя.
- blog_user in modules/blog/blog.module
- Реализация hook_user().
- blog_view in modules/blog/blog.module
- Реализация hook_view().
- book_admin_edit_submit in modules/book/book.admin.inc
- Handle submission of the book administrative page form.
- book_admin_overview in modules/book/book.admin.inc
- Возвращает административный краткий обзор всех книг.
- book_render in modules/book/book.pages.inc
- Menu callback; prints a listing of all books.
- chameleon_comment in themes/chameleon/chameleon.theme
- chameleon_node in themes/chameleon/chameleon.theme
- chameleon_page in themes/chameleon/chameleon.theme
- comment_admin_overview in modules/comment/comment.admin.inc
- Конструктор формы; генерирует форму с кратким содержанием комментариев для администратора.
- comment_admin_overview_submit in modules/comment/comment.admin.inc
- Process comment_admin_overview form submissions.
- comment_reply in modules/comment/comment.pages.inc
- This function is responsible for generating a comment reply form.
There are several cases that have to be handled, including:
replies to comments
replies to nodes
attempts to reply to nodes that can no longer accept comments
respecting access...
- comment_save in modules/comment/comment.module
- Сохраняет новый или измененный комментарий.
- confirm_form in modules/system/system.module
- Вывод формы подтверждения какого-либо действия.
- contact_admin_categories in modules/contact/contact.admin.inc
- Categories/list tab.
- contact_admin_edit_submit in modules/contact/contact.admin.inc
- Process the contact category edit page form submission.
- dblog_event in modules/dblog/dblog.admin.inc
- Коллбэк меню; отображает подробности записи журнала системы.
- dblog_overview in modules/dblog/dblog.admin.inc
- Коллбэк меню; выводит логи сообщений.
- db_status_report in includes/database.mysql.inc
- Возвращает отчёт о состоянии базы данных.
- filter_admin_format_form in modules/filter/filter.admin.inc
- Generate a filter format form.
See alsofilter_admin_format_form_validate()
- filter_admin_overview in modules/filter/filter.admin.inc
- Menu callback; Displays a list of all input formats and which
one is the default.
See alsofilter_admin_overview_submit()
- forum_nodeapi in modules/forum/forum.module
- Implementation of hook_nodeapi().
- forum_overview in modules/forum/forum.admin.inc
- Returns an overview list of existing forums and containers
- help_links_as_list in modules/help/help.admin.inc
- hook_requirements in developer/hooks/install.php
- Проверяет требования для установки и выдает сообщение о статусе.
- locale_update_6005 in modules/locale/locale.install
- Change language setting variable of content types.
- menu_edit_item in modules/menu/menu.admin.inc
- Menu callback; Build the menu link editing form.
- menu_get_active_breadcrumb in includes/menu.inc
- Получает хлебные крошки для текущей страницы, определенные активным путем.
- node_admin_nodes in modules/node/node.admin.inc
- Form builder: Builds the node administration overview.
- node_feed in modules/node/node.module
- A generic function for generating RSS feeds from a set of nodes.
- node_form_submit in modules/node/node.pages.inc
- node_overview_types in modules/node/content_types.inc
- Displays the content type admin overview page.
- node_revision_overview in modules/node/node.pages.inc
- Generate an overview table of older revisions of a node.
- node_title_list in modules/node/node.module
- Gather a listing of links to nodes.
- node_type_form_submit in modules/node/content_types.inc
- Implementation of hook_form_submit().
- openid_form_alter in modules/openid/openid.module
- Implementation of hook_form_alter : adds OpenID login to the login forms.
- openid_user_identities in modules/openid/openid.pages.inc
- Menu callback; Manage OpenID identities for the specified user.
- path_admin_overview in modules/path/path.admin.inc
- Return a listing of all defined URL aliases.
When filter key passed, perform a standard search on the given key,
and return the list of matching URL aliases.
- php_install in modules/php/php.install
- Реализация hook_install().
- poll_page in modules/poll/poll.pages.inc
- Menu callback to provide a simple list of all polls available.
- profile_admin_overview in modules/profile/profile.admin.inc
- Form builder to display a listing of all editable profile fields.
See alsoprofile_admin_overview_submit()
- profile_block in modules/profile/profile.module
- Реализация hook_block().
- profile_field_delete_submit in modules/profile/profile.admin.inc
- Process a field delete form submission.
- profile_field_form_submit in modules/profile/profile.admin.inc
- Process profile_field_form submissions.
- profile_view_field in modules/profile/profile.module
- search_view in modules/search/search.pages.inc
- Menu callback; presents the search form and/or search results.
- statistics_access_log in modules/statistics/statistics.admin.inc
- Menu callback; Displays recent page accesses.
- statistics_node_tracker in modules/statistics/statistics.pages.inc
- statistics_recent_hits in modules/statistics/statistics.admin.inc
- Menu callback; presents the 'recent hits' page.
- statistics_top_visitors in modules/statistics/statistics.admin.inc
- Menu callback; presents the 'top visitors' page.
- statistics_user_tracker in modules/statistics/statistics.pages.inc
- system_actions_manage in modules/system/system.module
- Menu callback. Display an overview of available and configured actions.
- system_admin_by_module in modules/system/system.admin.inc
- Menu callback; prints a listing of admin tasks for each installed module.
- system_get_module_admin_tasks in modules/system/system.module
- Создаёт список задач предлагаемый указанным модулем.
- system_requirements in modules/system/system.install
- Test and report Drupal installation requirements.
- system_themes_form in modules/system/system.admin.inc
- Menu callback; displays a listing of all themes.
See alsosystem_themes_form_submit()
- tablesort_header in includes/tablesort.inc
- Format a column header.
- taxonomy_form_term_submit in modules/taxonomy/taxonomy.admin.inc
- Обработчик кнопки "Отправить", формы добавления или обновления термина.
См. также taxonomy_form_term()
- taxonomy_form_vocabulary_submit in modules/taxonomy/taxonomy.admin.inc
- Accept the form submission for a vocabulary and save the results.
- taxonomy_overview_terms in modules/taxonomy/taxonomy.admin.inc
- Form builder for the taxonomy terms overview.
- taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.admin.inc
- Form builder to list and manage vocabularies.
See alsotaxonomy_overview_vocabularies_submit()
- taxonomy_term_page in modules/taxonomy/taxonomy.pages.inc
- Коллбэк меню; отображает все ноды, связанные с термином таксономии.
- template_preprocess_aggregator_feed_source in modules/aggregator/aggregator.pages.inc
- Process variables for aggregator-feed-source.tpl.php.
See alsoaggregator-feed-source.tpl.php
- template_preprocess_aggregator_item in modules/aggregator/aggregator.pages.inc
- Process variables for aggregator-item.tpl.php.
See alsoaggregator-item.tpl.php
- template_preprocess_comment in modules/comment/comment.module
- Process variables for comment.tpl.php.
See alsocomment.tpl.php
- template_preprocess_comment_folded in modules/comment/comment.module
- Process variables for comment-folded.tpl.php.
See alsocomment-folded.tpl.php
- template_preprocess_forums in modules/forum/forum.module
- Process variables for forums.tpl.php
- template_preprocess_forum_topic_list in modules/forum/forum.module
- Preprocess variables to format the topic listing.
- template_preprocess_user_picture in modules/user/user.module
- Process variables for user-picture.tpl.php.
- theme_admin_block_content in modules/system/system.admin.inc
- Функция форматирует контент административного блока.
- theme_admin_page in modules/system/system.admin.inc
- Форматирует административную страницу для отображения.
- theme_aggregator_block_item in modules/aggregator/aggregator.module
- Format an individual feed item for display in the block.
- theme_book_admin_table in modules/book/book.admin.inc
- Theme function for the book administration page form.
See alsobook_admin_table()
- theme_book_title_link in modules/book/book.module
- Generate the HTML output for a link to a book title when used as a block title.
Генерирует вывод HTML-кода для заголовка книги, при использовании в качестве заголовка блока.
- theme_comment_block in modules/comment/comment.module
- Returns a formatted list of recent comments to be displayed in the comment block.
- theme_filter_tips_more_info in modules/filter/filter.module
- Format a link to the more extensive filter tips.
- theme_links in includes/theme.inc
- Возвращает темизированный набор ссылок.
- theme_locale_languages_overview_form in includes/locale.inc
- Темизирует форму обзора языков сайта.
- theme_menu_item_link in includes/menu.inc
- Генерирует вывод HTML данных для единичной ссылки меню.
- theme_node_add_list in modules/node/node.pages.inc
- Выводит список доступных типов контента для создания нод.
- theme_pager_link in includes/pager.inc
- Форматирует ссылку на определенную запрошенную страницу.
- theme_system_powered_by in modules/system/system.module
- Форматирует текст надписи "Powered by Drupal" (Создано на Друпале).
- theme_update_report in modules/update/update.report.inc
- Темизирует сообщение о состоянии модуля или темы.
- theme_update_version in modules/update/update.report.inc
- Темизирует отображение версии проекта.
- theme_upload_attachments in modules/upload/upload.module
- Отображение прикрепленных файлов в виде таблицы.
- theme_username in includes/theme.inc
- Форматирует имя пользователя.
- theme_user_admin_new_role in modules/user/user.admin.inc
- Theme the new-role form.
- tracker_page in modules/tracker/tracker.pages.inc
- Menu callback. Prints a listing of active nodes on the site.
- translation_node_overview in modules/translation/translation.pages.inc
- Overview page for a node's translations.
- trigger_assign_form in modules/trigger/trigger.admin.inc
- Create the form definition for assigning an action to a hook-op combination.
- user_admin_access in modules/user/user.admin.inc
- Menu callback: list all access rules
- user_admin_account in modules/user/user.admin.inc
- Form builder; User administration page.
See alsouser_admin_account_validate()
- user_external_login_register in modules/user/user.module
- Helper function for authentication modules. Either login in or registers
the current user, based on username. Either way, the global $user object is
populated based on $name.
- user_login_block in modules/user/user.module
- user_register_submit in modules/user/user.module
- Обработчик формы регистрации пользователя.
- _locale_translate_seek in includes/locale.inc
- Perform a string search and display results in a table
- _menu_overview_tree_form in modules/menu/menu.admin.inc
- Recursive helper function for menu_overview_form().
- _menu_site_is_offline in includes/menu.inc
- Проверяет, находится ли сайт в автономном режиме "на обслуживании".
- _node_mass_update_batch_process in modules/node/node.admin.inc
- Node Mass Update Batch operation
- _statistics_link in modules/statistics/statistics.module
- It is possible to adjust the width of columns generated by the
statistics module.
- _update_refresh in modules/update/update.fetch.inc
- Fetch project info via XML from a central server.
- _update_requirement_check in modules/update/update.module
- Private helper method to fill in the requirements array.
Код
<?php
function l($text, $path, $options = array()) {
global $language;
$options += array(
'attributes' => array(),
'html' => FALSE,
);
if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) &&
(empty($options['language']) || $options['language']->language == $language->language)) {
if (isset($options['attributes']['class'])) {
$options['attributes']['class'] .= ' active';
}
else {
$options['attributes']['class'] = 'active';
}
}
if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
$options['attributes']['title'] = strip_tags($options['attributes']['title']);
}
return '<a href="'. check_url(url($path, $options)) .'"'. drupal_attributes($options['attributes']) .'>'. ($options['html'] ? $text : check_plain($text)) .'</a>';
}
?>
Пользовательские комментарии
Войдите или
зарегистрируйтесь, чтобы получить возможность отправлять комментарии
Судя по коду самой функции в $options может передаваться язык в $options['language'].
Затем этот праметр может быть передан фунции url()..