Revision 4cfd8be6
Added by Assos Assos over 9 years ago
drupal7/sites/all/modules/flag/flag.module | ||
---|---|---|
219 | 219 |
'access arguments' => array('administer flags'), |
220 | 220 |
'description' => 'Configure flags for marking content with arbitrary information (such as <em>offensive</em> or <em>bookmarked</em>).', |
221 | 221 |
'file' => 'includes/flag.admin.inc', |
222 |
'type' => MENU_NORMAL_ITEM, |
|
223 | 222 |
); |
224 | 223 |
$items[FLAG_ADMIN_PATH . '/list'] = array( |
225 | 224 |
'title' => 'List', |
... | ... | |
241 | 240 |
'page arguments' => array('flag_import_form'), |
242 | 241 |
'access arguments' => array('use flag import'), |
243 | 242 |
'file' => 'includes/flag.export.inc', |
244 |
'type' => MENU_LOCAL_TASK,
|
|
243 |
'type' => MENU_LOCAL_ACTION,
|
|
245 | 244 |
'weight' => 2, |
246 | 245 |
); |
247 | 246 |
$items[FLAG_ADMIN_PATH . '/export'] = array( |
... | ... | |
250 | 249 |
'page arguments' => array('flag_export_form'), |
251 | 250 |
'access arguments' => array('administer flags'), |
252 | 251 |
'file' => 'includes/flag.export.inc', |
253 |
'type' => MENU_LOCAL_TASK,
|
|
252 |
'type' => MENU_LOCAL_ACTION,
|
|
254 | 253 |
'weight' => 3, |
255 | 254 |
); |
256 | 255 |
|
... | ... | |
262 | 261 |
'access callback' => 'user_access', |
263 | 262 |
'access arguments' => array('administer flags'), |
264 | 263 |
'file' => 'includes/flag.admin.inc', |
265 |
'type' => MENU_CALLBACK,
|
|
264 |
'type' => MENU_LOCAL_TASK,
|
|
266 | 265 |
// Make the flag title the default title for descendant menu items. |
267 | 266 |
'title callback' => '_flag_menu_title', |
268 | 267 |
'title arguments' => array(FLAG_ADMIN_PATH_START + 1), |
... | ... | |
343 | 342 |
), |
344 | 343 |
); |
345 | 344 |
|
346 |
if (module_exists('field_ui')) { |
|
347 |
foreach (entity_get_info() as $obj_type => $info) { |
|
348 |
if ($obj_type == 'flagging') { |
|
349 |
foreach ($info['bundles'] as $bundle_name => $bundle_info) { |
|
350 |
if (isset($bundle_info['admin'])) { |
|
351 |
$fields = array(); |
|
352 |
|
|
353 |
foreach (field_info_instances($obj_type, $bundle_name) as $field) { |
|
354 |
$fields[] = $field['field_name']; |
|
355 |
} |
|
356 |
|
|
357 |
$arguments = array( |
|
358 |
'%flag' => array($bundle_name), |
|
359 |
'%field_ui_menu' => $fields, |
|
360 |
); |
|
361 |
|
|
362 |
$path = $bundle_info['admin']['path']; |
|
363 |
$map["$path/fields/%field_ui_menu"]['parent'] = "$path/fields"; |
|
364 |
$map["$path/fields/%field_ui_menu"]['arguments'][] = $arguments; |
|
365 |
} |
|
366 |
} |
|
367 |
} |
|
368 |
} |
|
369 |
} |
|
370 |
|
|
371 | 345 |
return $map; |
372 | 346 |
} |
373 | 347 |
|
... | ... | |
1569 | 1543 |
$action = $variables['action']; |
1570 | 1544 |
$entity_id = $variables['entity_id']; |
1571 | 1545 |
$errors = implode('<br />', $variables['errors']); |
1572 |
$flag_css_name = str_replace('_', '-', $flag->name);
|
|
1546 |
$flag_name_css = str_replace('_', '-', $flag->name);
|
|
1573 | 1547 |
|
1574 | 1548 |
// Generate the link URL. |
1575 | 1549 |
$link_type = $flag->get_link_type(); |
... | ... | |
1605 | 1579 |
$variables['link_text'] = isset($link['title']) ? $link['title'] : $flag->get_label($action . '_short', $entity_id); |
1606 | 1580 |
$variables['link_title'] = isset($link['attributes']['title']) ? check_plain($link['attributes']['title']) : check_plain(strip_tags($flag->get_label($action . '_long', $entity_id))); |
1607 | 1581 |
$variables['status'] = ($action == 'flag' ? 'unflagged' : 'flagged'); |
1608 |
$variables['flag_name_css'] = $flag_css_name;
|
|
1582 |
$variables['flag_name_css'] = $flag_name_css;
|
|
1609 | 1583 |
|
1610 | 1584 |
$variables['flag_wrapper_classes_array'] = array(); |
1611 | 1585 |
$variables['flag_wrapper_classes_array'][] = 'flag-wrapper'; |
1612 |
$variables['flag_wrapper_classes_array'][] = 'flag-' . $flag_css_name;
|
|
1613 |
$variables['flag_wrapper_classes_array'][] = 'flag-' . $flag_css_name . '-' . $entity_id;
|
|
1586 |
$variables['flag_wrapper_classes_array'][] = 'flag-' . $flag_name_css;
|
|
1587 |
$variables['flag_wrapper_classes_array'][] = 'flag-' . $flag_name_css . '-' . $entity_id;
|
|
1614 | 1588 |
|
1615 | 1589 |
$variables['flag_classes_array'] = array(); |
1616 | 1590 |
$variables['flag_classes_array'][] = 'flag'; |
... | ... | |
1794 | 1768 |
* The entity ID (usually the node ID). |
1795 | 1769 |
* |
1796 | 1770 |
* @return |
1797 |
* The flag count with the entity type and id as array keys.
|
|
1771 |
* The flag count with the flag names as array keys.
|
|
1798 | 1772 |
*/ |
1799 | 1773 |
function flag_get_counts($entity_type, $entity_id) { |
1800 | 1774 |
$counts = &drupal_static(__FUNCTION__); |
... | ... | |
2055 | 2029 |
* An array of flagging data, keyed by the flagging ID. |
2056 | 2030 |
*/ |
2057 | 2031 |
function flag_get_flag_flagging_data($flag_name) { |
2058 |
$return = array(); |
|
2059 | 2032 |
$flag = flag_get_flag($flag_name); |
2060 | 2033 |
$result = db_select('flagging', 'fc') |
2061 | 2034 |
->fields('fc') |
Also available in: Unified diff
Weekly update of contrib modules