2007-05-22 05:52:17 +00:00
< ? php
/**
2007-08-26 16:41:02 +00:00
* @ file
* Admin page callbacks for the system module .
*/
2014-04-07 15:01:20 +00:00
use Drupal\Component\Utility\Xss ;
2014-01-22 20:35:48 +00:00
use Drupal\Core\Cache\Cache ;
2014-03-11 17:19:24 +00:00
use Drupal\Core\Extension\Extension ;
2014-03-31 17:37:55 +00:00
use Drupal\Core\Render\Element ;
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
use Drupal\Core\Template\Attribute ;
2007-08-26 16:41:02 +00:00
2007-09-14 12:16:55 +00:00
/**
2007-12-16 21:01:45 +00:00
* Recursively check compatibility .
*
* @ param $incompatible
2009-01-14 12:18:37 +00:00
* An associative array which at the end of the check contains all
* incompatible files as the keys , their values being TRUE .
2007-12-16 21:01:45 +00:00
* @ param $files
* The set of files that will be tested .
2014-03-11 17:19:24 +00:00
* @ param \Drupal\Core\Extension\Extension $file
2007-12-16 21:01:45 +00:00
* The file at which the check starts .
* @ return
2009-01-14 12:18:37 +00:00
* Returns TRUE if an incompatible file is found , NULL ( no return value )
* otherwise .
2007-09-14 12:16:55 +00:00
*/
2014-03-11 17:19:24 +00:00
function _system_is_incompatible ( & $incompatible , $files , Extension $file ) {
if ( isset ( $incompatible [ $file -> getName ()])) {
2007-09-14 12:16:55 +00:00
return TRUE ;
}
2009-01-14 12:18:37 +00:00
// Recursively traverse required modules, looking for incompatible modules.
foreach ( $file -> requires as $requires ) {
if ( isset ( $files [ $requires ]) && _system_is_incompatible ( $incompatible , $files , $files [ $requires ])) {
2014-03-11 17:19:24 +00:00
$incompatible [ $file -> getName ()] = TRUE ;
2007-09-14 12:16:55 +00:00
return TRUE ;
}
}
}
2007-08-26 16:41:02 +00:00
/**
2014-02-24 09:47:14 +00:00
* Prepares variables for administrative content block templates .
*
* Default template : admin - block - content . html . twig .
2007-08-26 16:41:02 +00:00
*
2009-10-09 01:00:08 +00:00
* @ param $variables
* An associative array containing :
2010-10-01 15:24:18 +00:00
* - content : An array containing information about the block . Each element
* of the array represents an administrative menu item , and must at least
2014-02-24 09:47:14 +00:00
* contain the keys 'title' , 'link_path' , and 'localized_options' , which are
2010-10-01 15:24:18 +00:00
* passed to l () . A 'description' key may also be provided .
2007-08-26 16:41:02 +00:00
*/
2014-02-24 09:47:14 +00:00
function template_preprocess_admin_block_content ( & $variables ) {
if ( ! empty ( $variables [ 'content' ])) {
$compact = system_admin_compact_mode ();
$variables [ 'attributes' ] = array ( 'class' => array ( 'admin-list' ));
if ( $compact ) {
$variables [ 'attributes' ][ 'class' ][] = 'compact' ;
2007-08-26 16:41:02 +00:00
}
2014-02-24 09:47:14 +00:00
foreach ( $variables [ 'content' ] as $key => $item ) {
$variables [ 'content' ][ $key ][ 'link' ] = l ( $item [ 'title' ], $item [ 'link_path' ], $item [ 'localized_options' ]);
2010-10-01 15:24:18 +00:00
if ( ! $compact && isset ( $item [ 'description' ])) {
2014-04-07 15:01:20 +00:00
$variables [ 'content' ][ $key ][ 'description' ] = Xss :: filterAdmin ( $item [ 'description' ]);
2014-02-24 09:47:14 +00:00
}
else {
$variables [ 'content' ][ $key ][ 'description' ] = FALSE ;
2010-10-01 15:24:18 +00:00
}
2007-08-26 16:41:02 +00:00
}
}
}
/**
2014-03-12 19:20:46 +00:00
* Prepares variables for administrative index page templates .
*
* Default template : admin - page . html . twig .
2007-08-26 16:41:02 +00:00
*
2009-10-09 01:00:08 +00:00
* @ param $variables
* An associative array containing :
* - blocks : An array of blocks to display . Each array should include a
2010-04-13 15:23:03 +00:00
* 'title' , a 'description' , a formatted 'content' and a 'position' which
* will control which container it will be in . This is usually 'left' or
* 'right' .
2007-08-26 16:41:02 +00:00
*/
2014-03-12 19:20:46 +00:00
function template_preprocess_admin_page ( & $variables ) {
$variables [ 'system_compact_link' ] = array (
'#theme' => 'system_compact_link' ,
);
$variables [ 'containers' ] = array ();
2007-08-26 16:41:02 +00:00
$stripe = 0 ;
2014-03-12 19:20:46 +00:00
foreach ( $variables [ 'blocks' ] as $block ) {
if ( ! empty ( $block [ 'content' ][ '#content' ])) {
2007-08-26 16:41:02 +00:00
if ( empty ( $block [ 'position' ])) {
2014-03-12 19:20:46 +00:00
// Perform automatic striping.
2007-08-26 16:41:02 +00:00
$block [ 'position' ] = ++ $stripe % 2 ? 'left' : 'right' ;
}
2014-03-12 19:20:46 +00:00
$variables [ 'containers' ][ $block [ 'position' ]][ 'blocks' ][] = array (
'#theme' => 'admin_block' ,
'#block' => $block ,
);
2007-08-26 16:41:02 +00:00
}
}
}
/**
2012-07-22 04:23:27 +00:00
* Returns HTML for the output of the admin index page .
2007-12-06 09:58:34 +00:00
*
2009-10-09 01:00:08 +00:00
* @ param $variables
* An associative array containing :
* - menu_items : An array of modules to be displayed .
*
2007-12-06 09:58:34 +00:00
* @ ingroup themeable
2007-08-26 16:41:02 +00:00
*/
2010-10-01 15:24:18 +00:00
function theme_system_admin_index ( $variables ) {
2009-10-09 01:00:08 +00:00
$menu_items = $variables [ 'menu_items' ];
2007-08-26 16:41:02 +00:00
$container = array ( 'left' => '' , 'right' => '' );
$flip = array ( 'left' => 'right' , 'right' => 'left' );
$position = 'left' ;
2010-04-22 09:54:26 +00:00
// Iterate over all modules.
2007-08-26 16:41:02 +00:00
foreach ( $menu_items as $module => $block ) {
list ( $description , $items ) = $block ;
2010-04-22 09:54:26 +00:00
// Output links.
2007-08-26 16:41:02 +00:00
if ( count ( $items )) {
2013-09-25 07:49:11 +00:00
$admin_block_content = array (
'#theme' => 'admin_block_content' ,
'#content' => $items ,
);
2007-08-26 16:41:02 +00:00
$block = array ();
$block [ 'title' ] = $module ;
2013-09-25 07:49:11 +00:00
$block [ 'content' ] = drupal_render ( $admin_block_content );
2007-08-26 16:41:02 +00:00
$block [ 'description' ] = t ( $description );
2013-09-25 07:49:11 +00:00
$admin_block = array (
'#theme' => 'admin_block' ,
'#block' => $block ,
);
if ( $block_output = drupal_render ( $admin_block )) {
2007-08-26 16:41:02 +00:00
if ( ! isset ( $block [ 'position' ])) {
// Perform automatic striping.
$block [ 'position' ] = $position ;
$position = $flip [ $position ];
}
$container [ $block [ 'position' ]] .= $block_output ;
}
}
}
2013-09-25 07:49:11 +00:00
$system_compact_link = array ( '#theme' => 'system_compact_link' );
2009-02-18 14:28:25 +00:00
$output = '<div class="admin clearfix">' ;
2013-09-25 07:49:11 +00:00
$output .= drupal_render ( $system_compact_link );
2007-08-26 16:41:02 +00:00
foreach ( $container as $id => $data ) {
2009-02-18 14:28:25 +00:00
$output .= '<div class="' . $id . ' clearfix">' ;
2007-08-26 16:41:02 +00:00
$output .= $data ;
$output .= '</div>' ;
}
$output .= '</div>' ;
return $output ;
}
/**
2014-01-26 05:11:21 +00:00
* Prepares variables for status report template .
*
* Default template : status - report . html . twig .
2007-08-30 15:31:46 +00:00
*
2013-10-31 12:42:26 +00:00
* This theme function is dependent on install . inc being loaded , because
* that ' s where the constants are defined .
*
2009-10-09 01:00:08 +00:00
* @ param $variables
* An associative array containing :
2013-10-31 12:42:26 +00:00
* - requirements : An array of requirements / status items . Each requirement
* is an associative array containing the following elements :
* - title : The name of the requirement .
* - value : ( optional ) The current value ( version , time , level , etc ) .
* - description : ( optional ) The description of the requirement .
* - severity : ( optional ) The requirement ' s result / severity level , one of :
* - REQUIREMENT_INFO : Status information .
* - REQUIREMENT_OK : The requirement is satisfied .
* - REQUIREMENT_WARNING : The requirement failed with a warning .
* - REQUIREMENT_ERROR : The requirement failed with an error .
2007-08-26 16:41:02 +00:00
*/
2014-01-26 05:11:21 +00:00
function template_preprocess_status_report ( & $variables ) {
2010-10-09 05:18:53 +00:00
$severities = array (
REQUIREMENT_INFO => array (
'title' => t ( 'Info' ),
'class' => 'info' ,
),
REQUIREMENT_OK => array (
'title' => t ( 'OK' ),
'class' => 'ok' ,
),
REQUIREMENT_WARNING => array (
'title' => t ( 'Warning' ),
'class' => 'warning' ,
),
REQUIREMENT_ERROR => array (
'title' => t ( 'Error' ),
'class' => 'error' ,
),
);
2014-01-26 05:11:21 +00:00
foreach ( $variables [ 'requirements' ] as $i => $requirement ) {
2013-08-05 15:59:11 +00:00
// Always use the explicit requirement severity, if defined. Otherwise,
// default to REQUIREMENT_OK in the installer to visually confirm that
// installation requirements are met. And default to REQUIREMENT_INFO to
// denote neutral information without special visualization.
if ( isset ( $requirement [ 'severity' ])) {
$severity = $severities [( int ) $requirement [ 'severity' ]];
}
elseif ( defined ( 'MAINTENANCE_MODE' ) && MAINTENANCE_MODE == 'install' ) {
$severity = $severities [ REQUIREMENT_OK ];
}
else {
$severity = $severities [ REQUIREMENT_INFO ];
}
2014-01-26 05:11:21 +00:00
$variables [ 'requirements' ][ $i ][ 'severity_class' ] = $severity [ 'class' ];
$variables [ 'requirements' ][ $i ][ 'severity_title' ] = $severity [ 'title' ];
2007-08-26 16:41:02 +00:00
}
}
/**
2010-04-13 15:23:03 +00:00
* Returns HTML for the modules form .
2007-08-30 15:31:46 +00:00
*
2009-10-09 01:00:08 +00:00
* @ param $variables
* An associative array containing :
2010-04-13 15:23:03 +00:00
* - form : A render element representing the form .
2009-10-09 01:00:08 +00:00
*
2007-08-26 16:41:02 +00:00
* @ ingroup themeable
*/
2012-11-27 07:06:47 +00:00
function theme_system_modules_details ( $variables ) {
2009-10-09 01:00:08 +00:00
$form = $variables [ 'form' ];
2007-08-26 16:41:02 +00:00
// Individual table headers.
2008-07-23 07:37:06 +00:00
$rows = array ();
2012-11-27 07:06:47 +00:00
// Iterate through all the modules, which are children of this element.
2014-03-31 17:37:55 +00:00
foreach ( Element :: children ( $form ) as $key ) {
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
// Stick the key into $module for easier access.
2008-07-23 07:37:06 +00:00
$module = $form [ $key ];
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
// Create the row for the table.
2008-07-23 07:37:06 +00:00
$row = array ();
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
// Add the checkbox into the first cell.
2008-07-23 07:37:06 +00:00
unset ( $module [ 'enable' ][ '#title' ]);
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
$module [ '#requires' ] = array_filter ( $module [ '#requires' ]);
$module [ '#required_by' ] = array_filter ( $module [ '#required_by' ]);
$requires = ! empty ( $module [ '#requires' ]);
$required_by = ! empty ( $module [ '#required_by' ]);
$version = ! empty ( $module [ 'version' ][ '#markup' ]);
2009-08-22 14:34:23 +00:00
$row [] = array ( 'class' => array ( 'checkbox' ), 'data' => drupal_render ( $module [ 'enable' ]));
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
// Add the module label and expand/collapse functionalty.
2013-04-05 16:04:10 +00:00
$col2 = '<label id="module-' . $key . '" for="' . $module [ 'enable' ][ '#id' ] . '" class="module-name table-filter-text-source">' . drupal_render ( $module [ 'name' ]) . '</label>' ;
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
$row [] = array ( 'class' => array ( 'module' ), 'data' => $col2 );
2009-01-14 12:18:37 +00:00
// Add the description, along with any modules it requires.
2013-07-10 21:44:43 +00:00
$description = '' ;
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
if ( $version || $requires || $required_by ) {
$description .= ' <div class="requirements">' ;
if ( $version ) {
$description .= '<div class="admin-requirements">' . t ( 'Version: !module-version' , array ( '!module-version' => drupal_render ( $module [ 'version' ]))) . '</div>' ;
}
if ( $requires ) {
$description .= '<div class="admin-requirements">' . t ( 'Requires: !module-list' , array ( '!module-list' => implode ( ', ' , $module [ '#requires' ]))) . '</div>' ;
}
if ( $required_by ) {
$description .= '<div class="admin-requirements">' . t ( 'Required by: !module-list' , array ( '!module-list' => implode ( ', ' , $module [ '#required_by' ]))) . '</div>' ;
}
$description .= '</div>' ;
2008-07-23 07:37:06 +00:00
}
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
$links = '' ;
2009-11-17 21:24:19 +00:00
foreach ( array ( 'help' , 'permissions' , 'configure' ) as $key ) {
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
$links .= drupal_render ( $module [ 'links' ][ $key ]);
2009-11-17 21:24:19 +00:00
}
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
if ( $links ) {
$description .= ' <div class="links">' ;
$description .= $links ;
$description .= '</div>' ;
}
2013-07-10 21:44:43 +00:00
$details = array (
'#type' => 'details' ,
'#title' => '<span class="text"> ' . drupal_render ( $module [ 'description' ]) . '</span>' ,
'#attributes' => array ( 'id' => $module [ 'enable' ][ '#id' ] . '-description' ),
'#description' => $description ,
);
$col4 = drupal_render ( $details );
Issue #1790280 by nod_, Bojhan, Wim Leers, danillonunes, deviantintegral, Kiphaas7, benjifisher, sun, yoroy, Everett Zufelt, jenlampton, aspilicious: Module page redesign 2.0.
2012-11-21 19:35:03 +00:00
$row [] = array ( 'class' => array ( 'description' , 'expand' ), 'data' => $col4 );
2014-04-03 21:25:02 +00:00
$rows [] = $module [ '#attributes' ] + array ( 'data' => $row );
2007-08-26 16:41:02 +00:00
}
2013-09-25 07:49:11 +00:00
$table = array (
2014-03-12 15:46:33 +00:00
'#type' => 'table' ,
2013-09-25 07:49:11 +00:00
'#header' => $form [ '#header' ],
'#rows' => $rows ,
);
return drupal_render ( $table );
2008-07-23 07:37:06 +00:00
}
2007-08-26 16:41:02 +00:00
/**
2010-04-13 15:23:03 +00:00
* Returns HTML for a table of currently disabled modules .
2009-10-09 01:00:08 +00:00
*
* @ param $variables
* An associative array containing :
2010-04-13 15:23:03 +00:00
* - form : A render element representing the form .
2009-10-09 01:00:08 +00:00
*
2010-04-13 15:23:03 +00:00
* @ ingroup themeable
2007-08-26 16:41:02 +00:00
*/
2009-10-09 01:00:08 +00:00
function theme_system_modules_uninstall ( $variables ) {
$form = $variables [ 'form' ];
2007-08-26 16:41:02 +00:00
// No theming for the confirm form.
if ( isset ( $form [ 'confirm' ])) {
return drupal_render ( $form );
}
// Table headers.
$header = array ( t ( 'Uninstall' ),
t ( 'Name' ),
t ( 'Description' ),
);
// Display table.
$rows = array ();
2014-03-31 17:37:55 +00:00
foreach ( Element :: children ( $form [ 'modules' ]) as $module ) {
2013-09-19 16:22:53 +00:00
if ( ! empty ( $form [ 'modules' ][ $module ][ '#required_by' ])) {
$disabled_message = format_plural ( count ( $form [ 'modules' ][ $module ][ '#required_by' ]),
2010-11-20 03:34:30 +00:00
'To uninstall @module, the following module must be uninstalled first: @required_modules' ,
'To uninstall @module, the following modules must be uninstalled first: @required_modules' ,
2013-09-19 16:22:53 +00:00
array ( '@module' => $form [ 'modules' ][ $module ][ '#module_name' ], '@required_modules' => implode ( ', ' , $form [ 'modules' ][ $module ][ '#required_by' ])));
2010-11-20 03:34:30 +00:00
$disabled_message = '<div class="admin-requirements">' . $disabled_message . '</div>' ;
}
else {
$disabled_message = '' ;
}
2007-08-26 16:41:02 +00:00
$rows [] = array (
array ( 'data' => drupal_render ( $form [ 'uninstall' ][ $module ]), 'align' => 'center' ),
2014-04-06 20:59:26 +00:00
'<label for="' . $form [ 'uninstall' ][ $module ][ '#id' ] . '" class="module-name table-filter-text-source">' . drupal_render ( $form [ 'modules' ][ $module ][ 'name' ]) . '</label>' ,
2010-11-20 03:34:30 +00:00
array ( 'data' => drupal_render ( $form [ 'modules' ][ $module ][ 'description' ]) . $disabled_message , 'class' => array ( 'description' )),
2007-08-26 16:41:02 +00:00
);
}
2013-09-25 07:49:11 +00:00
$table = array (
2014-03-12 15:46:33 +00:00
'#type' => 'table' ,
2013-09-25 07:49:11 +00:00
'#header' => $header ,
'#rows' => $rows ,
'#empty' => t ( 'No modules are available to uninstall.' ),
);
2014-04-06 20:59:26 +00:00
$output = drupal_render ( $form [ 'filters' ]);
$output .= drupal_render ( $table );
2009-02-03 18:55:32 +00:00
$output .= drupal_render_children ( $form );
2007-08-26 16:41:02 +00:00
return $output ;
}
/**
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
* Prepares variables for appearance page templates .
*
* Default template : system - themes - page . html . twig .
2007-08-26 16:41:02 +00:00
*
2009-10-09 01:00:08 +00:00
* @ param $variables
* An associative array containing :
2009-12-01 00:39:35 +00:00
* - theme_groups : An associative array containing groups of themes .
2013-09-25 07:49:11 +00:00
* - theme_group_titles : An associative array containing titles of themes .
2007-08-26 16:41:02 +00:00
*/
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
function template_preprocess_system_themes_page ( & $variables ) {
$groups = array ();
2009-12-01 00:39:35 +00:00
$theme_groups = $variables [ 'theme_groups' ];
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$variables [ 'attributes' ][ 'id' ] = 'system-themes-page' ;
2009-12-01 00:39:35 +00:00
foreach ( $variables [ 'theme_group_titles' ] as $state => $title ) {
if ( ! count ( $theme_groups [ $state ])) {
// Skip this group of themes if no theme is there.
2007-08-26 16:41:02 +00:00
continue ;
}
2009-12-01 00:39:35 +00:00
// Start new theme group.
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$theme_group = array ();
$theme_group [ 'state' ] = $state ;
$theme_group [ 'title' ] = $title ;
$theme_group [ 'themes' ] = array ();
$theme_group [ 'attributes' ] = new Attribute ( array ( 'class' => array ( 'system-themes-list' , 'system-themes-list-' . $state , 'clearfix' )));
2007-08-26 16:41:02 +00:00
2010-09-28 02:30:32 +00:00
foreach ( $theme_groups [ $state ] as $theme ) {
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme = array ();
2007-08-26 16:41:02 +00:00
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
// Screenshot depicting the theme.
2013-07-10 18:37:49 +00:00
if ( $theme -> screenshot ) {
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'screenshot' ] = array (
2013-07-10 18:37:49 +00:00
'#theme' => 'image' ,
'#uri' => $theme -> screenshot [ 'uri' ],
'#alt' => $theme -> screenshot [ 'alt' ],
'#title' => $theme -> screenshot [ 'title' ],
'#attributes' => $theme -> screenshot [ 'attributes' ],
);
}
else {
2014-03-27 06:09:10 +00:00
$current_theme [ 'screenshot' ] = array (
'#theme' => 'image' ,
'#uri' => drupal_get_path ( 'module' , 'system' ) . '/images/no_screenshot.png' ,
'#alt' => t ( 'No screenshot' ),
'#title' => t ( 'No screenshot' ),
'#attributes' => new Attribute ( array ( 'class' => array ( 'no-screenshot' ))),
);
2013-07-10 18:37:49 +00:00
}
2007-08-26 16:41:02 +00:00
2009-12-01 00:39:35 +00:00
// Localize the theme description.
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'description' ] = t ( $theme -> info [ 'description' ]);
2009-12-01 00:39:35 +00:00
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
// Style theme info.
2009-12-01 00:39:35 +00:00
$theme -> classes [] = 'theme-selector' ;
$theme -> classes [] = 'clearfix' ;
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'attributes' ] = new Attribute ( array ( 'class' => $theme -> classes ));
$current_theme [ 'name' ] = $theme -> info [ 'name' ];
$current_theme [ 'version' ] = isset ( $theme -> info [ 'version' ]) ? $theme -> info [ 'version' ] : '' ;
$current_theme [ 'notes' ] = $theme -> notes ;
2009-12-01 00:39:35 +00:00
// Make sure to provide feedback on compatibility.
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'incompatible' ] = '' ;
2009-12-01 00:39:35 +00:00
if ( ! empty ( $theme -> incompatible_core )) {
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'incompatible' ] = t ( 'This version is not compatible with Drupal !core_version and should be replaced.' , array ( '!core_version' => \Drupal :: CORE_COMPATIBILITY ));
2009-12-01 00:39:35 +00:00
}
elseif ( ! empty ( $theme -> incompatible_php )) {
if ( substr_count ( $theme -> info [ 'php' ], '.' ) < 2 ) {
$theme -> info [ 'php' ] .= '.*' ;
}
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'incompatible' ] = t ( 'This theme requires PHP version @php_required and is incompatible with PHP version !php_version.' , array ( '@php_required' => $theme -> info [ 'php' ], '!php_version' => phpversion ()));
2009-12-01 00:39:35 +00:00
}
2012-08-06 13:18:08 +00:00
elseif ( ! empty ( $theme -> incompatible_base )) {
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'incompatible' ] = t ( 'This theme requires the base theme @base_theme to operate correctly.' , array ( '@base_theme' => $theme -> info [ 'base theme' ]));
2012-08-06 13:18:08 +00:00
}
elseif ( ! empty ( $theme -> incompatible_engine )) {
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$current_theme [ 'incompatible' ] = t ( 'This theme requires the theme engine @theme_engine to operate correctly.' , array ( '@theme_engine' => $theme -> info [ 'engine' ]));
2009-12-01 00:39:35 +00:00
}
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
// Build operation links.
$current_theme [ 'operations' ] = array (
'#theme' => 'links' ,
'#links' => $theme -> operations ,
'#attributes' => array (
'class' => array ( 'operations' , 'clearfix' ),
),
);
$theme_group [ 'themes' ][] = $current_theme ;
2007-08-26 16:41:02 +00:00
}
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$groups [] = $theme_group ;
2007-08-26 16:41:02 +00:00
}
Issue #2151119 by joelpittet, InternetDevels, jamesrutherford, Cottser, idflood, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Convert theme_system_themes_page() to Twig.
2014-03-07 22:30:43 +00:00
$variables [ 'theme_groups' ] = $groups ;
2008-08-21 19:36:39 +00:00
}
2014-01-29 08:25:00 +00:00