commit 9430705d0f80edbc22077a2f9fddfdb98551846a Author: Jen Lampton Date: Sun Mar 10 17:49:59 2013 -0700 updates to node module diff --git a/core/modules/node/node.module b/core/modules/node/node.module index ec6e24d..e897242 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1134,6 +1134,25 @@ function node_preprocess_block(&$variables) { } /** + * Prepares variables for node edit form templates. + * + * Default template: node-edit-form.html.twig. + * + * @param array $variables + * An associative array containing: + * - form: The complete node form. + */ +function template_preprocess_node_edit_form(&$variables) { + $form = $variables['form']; + + // @todo update this once http://drupal.org/node/1920886 is resolved + $variables['advanced'] = $form['advanced']; + $variables['actions'] = $form['actions']; + unset($form['advanced'], $form['actions']); + $variables['form'] = drupal_render_children($form); +} + +/** * Prepares variables for node templates. * * Default template: node.html.twig. @@ -1349,7 +1368,7 @@ function node_search_admin() { ); $form['content_ranking']['#theme'] = 'node_search_admin'; $form['content_ranking']['info'] = array( - '#value' => '' . t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') . '' + '#markup' => '' . t('The following numbers control which properties the content search should favor when ordering the results. Higher numbers mean more influence, zero means the property is ignored. Changing these numbers does not require the search index to be rebuilt. Changes take effect immediately.') . '' ); // Note: reversed to reflect that higher number = higher ranking. @@ -1532,8 +1551,8 @@ function node_user_predelete($account) { */ function template_preprocess_node_search_admin(&$variables) { $form = $variables['form']; - - $output = drupal_render($form['info']); +debug($form['info']); + $variables['info'] = $form['info']; $header = array(t('Factor'), t('Weight')); foreach (element_children($form['factors']) as $key) { @@ -1549,6 +1568,8 @@ function template_preprocess_node_search_admin(&$variables) { '#header' => $header, '#rows' => $rows, ); + // @todo remove this once drupal.org/node/1920886 is resolved. + unset($form['info']); $variables['form'] = drupal_render_children($form); } @@ -1958,7 +1979,10 @@ function template_preprocess_node_recent_block(&$variables) { foreach ($variables['nodes'] as $node) { $row = array(); $row[] = array( - 'data' => theme('node_recent_content', array('node' => $node)), + 'data' => array( + '#theme' => 'node_recent_content', + '#node' => $node, + ), 'class' => 'title-author', ); if (node_access('update', $node)) { diff --git a/core/modules/node/templates/node-add-list.html.twig b/core/modules/node/templates/node-add-list.html.twig index 0f629ad..f613c11 100644 --- a/core/modules/node/templates/node-add-list.html.twig +++ b/core/modules/node/templates/node-add-list.html.twig @@ -5,7 +5,8 @@ * * Available variables: * - types: List of content types. - * - no_content_text: Text displayed when no content types are available. + * - type.add_link: Link to create a piece of content of this type. + * - type.description: Description of this type of content. * * @see template_preprocess() * @see template_preprocess_node_add_list() diff --git a/core/modules/node/templates/node-edit-form.html.twig b/core/modules/node/templates/node-edit-form.html.twig new file mode 100644 index 0000000..d58651f --- /dev/null +++ b/core/modules/node/templates/node-edit-form.html.twig @@ -0,0 +1,25 @@ +{# +/** + * @file + * Two column template for the node add/edit form. + * + * Available variables: + * - form: The remainder of the node edit form, after advanced and actions + * have been hidden. + * - advanced: The advanced options for the node form. + * - actions: The action buttons for save and delete. + * + * @ingroup themable + */ +#} +
+
+ {{ form }} +
+
+ {{ advanced }} +
+ +
\ No newline at end of file diff --git a/core/modules/node/templates/node-edit-form.tpl.php b/core/modules/node/templates/node-edit-form.tpl.php deleted file mode 100644 index 7b76683..0000000 --- a/core/modules/node/templates/node-edit-form.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -
-
- -
- -
- -
- - -
diff --git a/core/modules/node/templates/node-preview.html.twig b/core/modules/node/templates/node-preview.html.twig index 1611c7e..aa8ec0e 100644 --- a/core/modules/node/templates/node-preview.html.twig +++ b/core/modules/node/templates/node-preview.html.twig @@ -6,8 +6,7 @@ * This display may be used during node creation and editing. * * Available variables: - * - preview_teaser: Flag indicating whether or not to show a trimmed teaser - * version. + * - preview_teaser: Flag indicating whether to show a trimmed teaser version. * - teaser: Trimmed teaser version of the node. * - full: Full version of the node. * diff --git a/core/modules/node/templates/node-search-admin.html.twig b/core/modules/node/templates/node-search-admin.html.twig index 4e4e1fb..bce2ed1 100644 --- a/core/modules/node/templates/node-search-admin.html.twig +++ b/core/modules/node/templates/node-search-admin.html.twig @@ -4,6 +4,7 @@ * Returns HTML for the content ranking part of the search settings admin page. * * Available variables: + * - info: Information for the user about the search ranking settings form. * - table: The table of the settings. * - form: A render element representing the form. * @@ -13,5 +14,6 @@ * @ingroup themeable */ #} +{{ info }} {{ table }} {{ form }} diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index 4c708dd..3ff5639 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -5,40 +5,38 @@ * * Available variables: * - title: The node title. - * - content: An array of node items. Use {{ content }} to print them all, + * - content: All node items. Use {{ content }} to print them all, * or print a subset such as {{ content.field_example }}. Use * {% hide(content.field_example) %} to temporarily suppress the printing * of a given element. - * - author: Themed username of node author output from theme_username(). + * - author: Themed username of node author output from username.html.twig. * - user_picture: The node author's picture from user-picture.html.twig. - * - created: Formatted creation date. Preprocess functions can reformat it by - * calling format_date() with the desired parameters on the $created variable. + * - created: Formatted creation date. * - changed: Formatted last updated date. * - node_url: Direct URL of the current node. * - display_submitted: Whether submission information should be displayed. - * - attributes: An instance of the Attributes class that can be manipulated as - * an array and printed as a string. - * It includes the 'class' information, which contains: - * - node: The current template type; for example, "theming hook". + * - attributes: Remaining HTML attributes for the containing element. + * - attributes.class: Class information, containing: + * - node: The current template type (also known as a "theming hook"). * - node-[type]: The current node type. For example, if the node is a * "Article" it would result in "node-article". Note that the machine * name will often be in a short form of the human readable label. - * - view-mode-[view_mode]: The View Mode of the node; for example, "teaser" - * or "full". - * - preview: Nodes in preview mode. + * - view-mode-[view_mode]: The View Mode of the node; for example, a teaser + * would result in: "view-mode-easer", and full: "view-mode-full". + * - preview: Whether a node is in preview mode. * The following are controlled through the node publishing options. - * - promoted: Nodes promoted to the front page. - * - sticky: Nodes ordered above other non-sticky nodes in teaser + * - promoted: Appears on nodes promoted to the front page. + * - sticky: Appears on nodes ordered above other non-sticky nodes in teaser * listings. - * - unpublished: Unpublished nodes visible only to administrators. + * - unpublished: Appears on unpublished nodes visible only to site admins. * - title_prefix: Additional output populated by modules, intended to be * displayed in front of the main title tag that appears in the template. * - title_suffix: Additional output populated by modules, intended to be * displayed after the main title tag that appears in the template. * * Other variables: - * - node: Full node entity. Contains data that may not be safe. - * - type: Node type; for example, page, article, etc. + * - node: Full node entity. + * - type: Node type; for example, "page" or "article". * - comment_count: Number of comments attached to the node. * - uid: User ID of the node author. * - zebra: Outputs either "even" or "odd". Useful for zebra striping in @@ -62,16 +60,16 @@ * is an administrator. * * Field variables: for each field instance attached to the node a corresponding - * variable is defined; for example, $node->body becomes body. When needing to + * variable is defined; for example, 'node.body' becomes 'body'. When needing to * access a field's raw values, developers/themers are strongly encouraged to * use these variables. Otherwise they will have to explicitly specify the - * desired field language; for example, $node->body['en'], thus overriding any - * language negotiation rule that was previously applied. + * desired field language; for example, 'node.body.en', thus overriding any + * language negotiation rule that may have been applied previously. * * @see template_preprocess() * @see template_preprocess_node() * - * @todo Might be a good idea to remove the id attribute, because if that gets + * @todo Remove the id attribute (or make it a class), because if that gets * rendered twice on a page this is invalid CSS for example: two lists * in different view modes. * @@ -93,7 +91,7 @@ {% endif %} -
+
{# We hide the comments and links now so that we can render them later. #} {% hide(content.comments) %} {% hide(content.links) %}