Révision c304a780
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/ctools/plugins/content_types/custom/custom.inc | ||
---|---|---|
178 | 178 |
|
179 | 179 |
static $delta = 0; |
180 | 180 |
|
181 |
$block = new stdClass(); |
|
182 |
$block->subtype = ++$delta; |
|
183 |
$block->title = filter_xss_admin($settings['title']); |
|
181 |
$block = new stdClass();
|
|
182 |
$block->subtype = ++$delta;
|
|
183 |
$block->title = filter_xss_admin($settings['title']);
|
|
184 | 184 |
$block->title_heading = isset($settings['title_heading']) ? $settings['title_heading'] : 'h2'; |
185 | 185 |
|
186 |
|
|
187 | 186 |
// Add keyword substitutions if we were configured to do so. |
188 | 187 |
$content = $settings['body']; |
189 | 188 |
if (!empty($contexts) && !empty($settings['substitute'])) { |
... | ... | |
270 | 269 |
$form_state['settings'] = $settings; |
271 | 270 |
|
272 | 271 |
if ($settings['custom_type'] == 'fixed') { |
273 |
return $form; // no form for this case. |
|
272 |
// No form for this case. |
|
273 |
return $form; |
|
274 | 274 |
} |
275 | 275 |
|
276 | 276 |
$form['admin_title'] = array( |
... | ... | |
320 | 320 |
); |
321 | 321 |
|
322 | 322 |
if (!empty($form_state['contexts'])) { |
323 |
// Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords |
|
323 |
// Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords.
|
|
324 | 324 |
if (module_exists('content') && module_exists('token')) { |
325 | 325 |
$description = t('If checked, context keywords will be substituted in this content. Note that CCK fields may be used as keywords using patterns like <em>%node:field_name-formatted</em>.'); |
326 | 326 |
} |
... | ... | |
417 | 417 |
form_error($form['name'], t('Name is required.')); |
418 | 418 |
} |
419 | 419 |
|
420 |
// Check for string identifier sanity |
|
420 |
// Check for string identifier sanity.
|
|
421 | 421 |
if (!preg_match('!^[a-z0-9_]+$!', $form_state['values']['name'])) { |
422 | 422 |
form_error($form['name'], t('The name can only consist of lowercase letters, underscores, and numbers.')); |
423 | 423 |
return; |
... | ... | |
427 | 427 |
return; |
428 | 428 |
} |
429 | 429 |
|
430 |
// Check for name collision |
|
430 |
// Check for name collision.
|
|
431 | 431 |
if ($form_state['values']['name'] == 'custom' || (ctools_export_crud_load('ctools_custom_content', $form_state['values']['name']))) { |
432 | 432 |
form_error($form['name'], t('Content with this name already exists. Please choose another name or delete the existing item before creating a new one.')); |
433 | 433 |
} |
... | ... | |
447 | 447 |
} |
448 | 448 |
// If the 'reusable' checkbox was checked, we will create a new |
449 | 449 |
// custom content and give it the proper values. |
450 |
else if (!empty($form_state['values']['reusable'])) {
|
|
450 |
elseif (!empty($form_state['values']['reusable'])) { |
|
451 | 451 |
$content = ctools_export_crud_new('ctools_custom_content'); |
452 | 452 |
$content->name = $form_state['values']['name']; |
453 | 453 |
_ctools_custom_content_type_edit_save($content, $form_state); |
... | ... | |
455 | 455 |
} |
456 | 456 |
else { |
457 | 457 |
// Otherwise, just save values into $conf normally. |
458 |
|
|
459 | 458 |
foreach (array_keys($form_state['plugin']['defaults']) as $key) { |
460 | 459 |
$form_state['conf'][$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : $form_state['plugin']['defaults'][$key]; |
461 | 460 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules