Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I try to create a Subtheme of Mayo and i have a lot of problem.
I try to override theme functions and it doesn't work.
In file template.php in my subtheme (name station) i declare
function station_build_columns($columns) {
$styles = array();
$num_columns = 0;
$first = -1;
for ($i = 0 ; $i < 4 ; $i++) {
if ($columns[$i]) {
if ($first == -1) $first = $i;
$last = $i;
$num_columns++;
}
}
if (!$num_columns) return '';
$out = '';
$out .= '<div class="column-blocks2 clearfix">';
....
But this code is never execute.
However, i try override
function mayo_page_alter($page) {
// Add meta tag for viewport, for easier responsive theme design.
$viewport = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1',
),
);
drupal_add_html_head($viewport, "viewport");
}
Like this
function station_page_alter($page) {
// Add meta tag for viewport, for easier responsive theme design.
$viewport = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport2',
'content' => 'width=device-width, initial-scale=1',
),
);
drupal_add_html_head($viewport, "viewport2");
}
And i have 2 meta tag viewport and viewport2.
I don't understand how i can override a function.
A other problem, i have this message in adminstrator page of the subtheme.
Notice : Array to string conversion dans mayo_get_plugins() (ligne 34 dans C:\wamp\www\station_bo\sites\all\themes\mayo\inc\plugins.inc).
Thanks
Comment | File | Size | Author |
---|---|---|---|
#17 | mayo_sitestaz.zip | 100.89 KB | XTaz |
Comments
Comment #1
lbernard CreditAttribution: lbernard commentedComment #2
mermentau CreditAttribution: mermentau commentedI changed the Category to "Support request" since the Mayo theme works fine and you need help with a sub-theme. The problem is that it's hard to help on that as we don't have access to your sub-theme code. Did you see this documentation for making a sub-theme for Mayo? Have you been through all the other documentation on drupal.org concerning making sub-themes?
Comment #3
lbernard CreditAttribution: lbernard commentedI saw the documentation for making sub-theme for Drupal and for Mayo.
I just create a directory name "station" (my subtheme).
I copied directory "colors".
I created the file station.info
I created directory css with 2 files : style.css and colors.css (no change for the moment).
And i have the message in administrator page of sub-theme
After i added a new file template.php with the 2 functions station_build_columns and station_page_alter with the problem (see first comment).
Thanks
Comment #4
veskimees CreditAttribution: veskimees commentedIt seems that I have a similar problem -- subtheme css doesn't have any effect.
I updated my page lately and made subtheme (yes, I read all instructions).
Something is wrong because I tried everything in sv.css (even #page-title {color: red !important;} ;-) ) and simply nothing.
I will humbly appreciate any hint and of course I will gladly give any further information.
Comment #5
mermentau CreditAttribution: mermentau commentedCould you make a quick sub-theme with Bartik and see if you have the same problems?
Comment #6
veskimees CreditAttribution: veskimees commentedJust did, it works fine (test.veskimees.eu is ugly red :-)).
Comment #7
mermentau CreditAttribution: mermentau commentedI emailed you through your contact link here.
Comment #8
veskimees CreditAttribution: veskimees commentedOK, sorry, I just put theme back one more time and It works...
Why... I really don't know. It seams that my post is irrelevant now, but there are something...
(I made Bartik subtheme, made that default and only made my mayo subtheme default again -- and It works... Maybe Bartik subtheme wrote something somewhere... I realize it sound little bit scholastic, but that mayo subtheme was first I ever made on that site...)
Sorry again to waste your time and thanks for reply. (But I - honestly! - really had a problem! ;-) )
Comment #9
veskimees CreditAttribution: veskimees commentedJust maybe it helps somebody: I made same things with my live site:
Mayo subtheme didn't work.
I made Bartik subtheme, set it default and then set my mayo subtheme default again and it works.
Mystic...
Comment #10
mermentau CreditAttribution: mermentau commentedGood to hear it's working. Thanks for the follow up.
Comment #12
XTazHi
Same error for me
Notice : Array to string conversion dans mayo_get_plugins() (ligne 34 dans T:\....\sites\all\themes\mayo\inc\plugins.inc).
i have just create a new sub theme following ALL instructions in this post https://www.drupal.org/node/2261457
______________________________________
I have already created a MAYO sub theme on another site and i have NO error.
If i put this old subtheme in a new install, the error appears !!!!!
______________________________________
I post here because i don't know if i have to create a new issue .
PS : try with MAYO 2.5 and i have same error with last dev version(2015-May-30)
Thanks
Comment #13
XTazAnother test with the same MAYO subtheme, MAYO 2.5 and AcquiaDevDesktop:
It's OK if site running on PHP 5.3.29 and ERROR with php 5.4.39
Comment #14
mermentau CreditAttribution: mermentau commentedI don't think the PHP version is the problem. I'm running PHP 5.5.15 and 5.5.17. Did you try clearing cache and disable/re-enable MAYO and possibly disable/re-enable the sub-theme too?
Comment #15
XTaz1- MAYO and subtheme disable
2- Clear all cache
3- re-enble MAYO and subtheme
4- Clear all cache again
I've got always same error
try the same with PHP 5.5.23 => same error
back to 5.3.29 without clearing cache => no error
Comment #16
mermentau CreditAttribution: mermentau commentedYou are trying two versions of PHP, but are they not 2 entirely different installs of Drupal on two different servers?
I'll probably not be of much help unless you can guide me to seeing the issue on my side here.
Comment #17
XTazIt's not 2 entirely different installs of Drupal on two different servers.
I test on localhost with Acquia Dev Desktop under Windows 7.
I try with a new D7 install true DevDesktop.
Install MAYO and my subtheme.
Under DevDesktop, i choose PHP 5.4.39.
Error message display on settings page of my subtheme. (admin/appearance/settings/mayo_sub).
Perhaps, i do something wrong but i don't see where.
I try to do same as https://www.drupal.org/node/2261457.
Sorry for my poor english
Join my sub theme files
Comment #18
mermentau CreditAttribution: mermentau commentedSaw the error using your sub-theme. Try editing sites/all/mayo/inc/plugins.inc line 34 to look like this:
array_unique($plugins_list, SORT_REGULAR);
Comment #19
XTazNo more error after the change.
Very cool, thanks a lot.
Comment #20
mermentau CreditAttribution: mermentau commentedCommitted it to the dev version. Thanks XTaz for the report and sending the sub-theme for test.