Projet

Général

Profil

Révision 503b3f7b

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/entity/entity.module
203 203
  if (isset($entity)) {
204 204
    list(, , $bundle) = entity_extract_ids($entity_type, $entity);
205 205
  }
206
  else {
207
    $bundle = NULL;
208
  }
206 209
  return entity_ui_get_action_title($op, $entity_type, $bundle);
207 210
}
208 211

  
......
1274 1277
  return drupal_build_form($form_id, $form_state);
1275 1278
}
1276 1279

  
1280

  
1281
/**
1282
 * Gets the page/menu title for local action operations.
1283
 *
1284
 * @param $op
1285
 *  The current operation. One of 'add' or 'import'.
1286
 * @param $entity_type
1287
 *  The entity type.
1288
 * @param $bundle_name
1289
 *  (Optional) The name of the bundle. May be NULL if the bundle name is not
1290
 *  relevant to the current page. If the entity type has only one bundle, or no
1291
 *  bundles, this will be the same as the entity type.
1292
 */
1293
function entity_ui_get_action_title($op, $entity_type, $bundle_name = NULL) {
1294
  $info = entity_get_info($entity_type);
1295
  switch ($op) {
1296
    case 'add':
1297
      if (isset($bundle_name) && $bundle_name != $entity_type) {
1298
        return t('Add @bundle_name @entity_type', array(
1299
          '@bundle_name' => drupal_strtolower($info['bundles'][$bundle_name]['label']),
1300
          '@entity_type' => drupal_strtolower($info['label']),
1301
        ));
1302
      }
1303
      else {
1304
        return t('Add @entity_type', array('@entity_type' => drupal_strtolower($info['label'])));
1305
      }
1306
    case 'import':
1307
      return t('Import @entity_type', array('@entity_type' => drupal_strtolower($info['label'])));
1308
  }
1309
}
1310

  
1277 1311
/**
1278 1312
 * Helper for using i18n_string().
1279 1313
 *

Formats disponibles : Unified diff