Created
March 17, 2015 21:41
-
-
Save frederickjh/17a1df41a749041ce1d4 to your computer and use it in GitHub Desktop.
Code from slide 47 of "Tailor your backend to meet the clients needs" - Improve the URL selection form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Text from slide 47 of "Tailor your backend to meet the clients needs" | |
* http://www.slideshare.net/stevenvdhout/durable-drupal-backend | |
* Improve the URL selection form | |
**/ | |
if (isset($form['#entity_type']) | |
&& $form['#entity_type'] == 'node' | |
&& isset($form['path']) | |
&& isset($form['path']['alias'])) { | |
unset($form['path']['#type']); // remove the fieldset | |
unset($form['path']['alias']['#description']); | |
$form['path']['alias']['#title'] = '<strong>' . t('Path') . ':</strong> '; | |
$form['path']['alias']['#title'] .= | |
(isset($_SERVER['HTTPS'])) ? 'https://' . $_SERVER['HTTP_HOST'] . '/' : 'http://' . $_SERVER['HTTP_HOST'] . '/'; | |
if (isset($form['path']['pathauto'])) { | |
$form['path']['alias']['#states'] = array(); | |
if (!$form['path']['alias']['#default_value']) { | |
$form['path']['alias']['#attributes'] = array('placeholder' => '<' . t('magically generated') . '>'); | |
} | |
$form['#submit'][] = 'ux_pathauto_submit'; | |
// remove the group variable, so it does not get rendered in the fieldset below | |
unset($form['path']['#group']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.slideshare.net/stevenvdhout/durable-drupal-backend
https://www.youtube.com/watch?v=N0JHKi-OosM