Drupal module Features. Some Tips.

Julia 29/07/2010

Module features is necessary for site builders in order to maintain big projects.

Some tips about this great module:

Doesn't want to be reverted

It happens sometimes that overridden feature pack doesn't want to be reverted,
for example after updating it in another system.

The solution is simple, if this feature pack has views objects.
You just have to flush views cache and try again.

Show views that are overridden

If you have a lot of feature packs with many views in them
and one of views was changed - in the overridden section
you won't understand the name of view that was changed.

To see it - add template file to your theme:
features-admin-components.tpl.php

<div class='clear-block features-components'>
  <div class='column'>
    <div class='info'>
      <h3><?php print $name ?></h3>
      <div class='description'><?php print $description ?></div>
      <?php print $dependencies ?>
    </div>
  </div>
  <div class='column'>
    <div class='components'>
      <?php print $components ?>
      <div class='buttons clear-block'><?php print $buttons ?></div>
    </div>
  </div>
  <?php print $form ?>
 
<?php   
$component
= 'views';
$normal = features_get_normal($name, $component);
$default = features_get_default($name, $component);

foreach (

$normal as $k => $view){
  
$compare = array('normal' => features_var_export($normal[$k]), 'default' => features_var_export($default[$k]));
        if (
_features_linetrim($compare['normal']) !== _features_linetrim($compare['default'])) {
         
$changed .= l($k, 'admin/build/views/edit/'. $k) . '<br/>';
        }
}

if (

$changed) {print '<div><h4>Changed views:</h4>'. $changed .'</div>'; }
?>

</div>

Отправить новый комментарий

Содержимое этого поля хранится скрыто и не будет показываться публично.
  • Адреса страниц и электронной почты автоматически преобразовываются в ссылки.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Автоматический перевод строки.
  • Вы можете публиковать код, размещая его в <code>...</code> (generic) или в <?php ... ?> (раскрашенный PHP).

Дополнительная информация о настройках форматирования