Last active
January 26, 2016 22:06
-
-
Save labboy0276/18dbc8ce7eba74c4defa to your computer and use it in GitHub Desktop.
Force FPP Admin Title, Change as needed
This file contains 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
name = Kettering Force Title | |
description = This module is for forcing the admin title on all FPPs that are reusable. | |
package = Kettering | |
core = 7.x | |
version = 7.x-0.1 | |
dependencies[] = fieldable_panels_panes |
This file contains 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 | |
/** | |
* @file | |
* The k2m_force_title.module file | |
*/ | |
/** | |
* Implementation of function hook_form_alter() | |
* | |
* Changes the Admin title so it is easier to find things. | |
*/ | |
function k2m_force_title_form_alter(&$form, &$form_state, $form_id) { | |
$forms = array( | |
'fieldable_panels_panes_entity_edit_form', | |
'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form' | |
); | |
if (in_array($form_id, $forms)) { | |
if ($form['#bundle'] == 'k2m_infographics') { | |
$form['reusable']['reusable']['#default_value'] = 1; | |
} | |
$bundle = str_replace('_', ' ', $form['#bundle']); | |
$bundle = str_replace('k2m', 'K2M', $bundle); | |
$title = ucwords($bundle) . ' - ' . $form['#entity']->title; | |
$form['reusable']['admin_title']['#default_value'] = $title; | |
$form['reusable']['admin_title']['#disabled'] = TRUE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment