1

I have a phtml template that has the following code in it:

<?php $links = $this->getLinks(); ?>
<ul class="social-links">
    <?php foreach ($links as $name => $group): ?>
        <?php if (!empty($group['handle'])): ?>
            <?php
                $class = "";
                $anchorText = "";
                switch ($group['css_class']) {
                    case "facebook":
                        $class = "facebook";
                        $anchorText = "Facebook";
                        break;
                    case "twitter":
                        $class = "twitter";
                        $anchorText = "Twitter";
                        break;
                   case "google-plus":
                       $class = "google";
                        $anchorText = "Google+";
                        break;
                }
            ?>
            <li>
                <a href="<?php echo $this->escapeUrl($group['url'].$group['handle']) ?>" class="social-link <?php echo $class; ?>" target="_blank"><?php echo $anchorText; ?></a>
            </li>
        <?php endif; ?>
    <?php endforeach; ?>
</ul>

I need to modify the links to remove google+ but I can't find where $this->getLinks() is coming from. Any pointers for where to look would be appreciated.

1 Answer 1

0

Look for the block in your layout xml files, that's the class you look for. Another option is to insert a Mage::log(get_class($this)) in your template. This should print the class of your block in the logfile if logging is enabled. If the method getLinks() is 'magic' you might overwrite the block and add your own getLinks() method and debug the provenience of the data.

5
  • in layout.xml I can see this <block type="social_links/social" name="social" as="gcm.social" template="xxx/social/links.phtml" /> but the code pasted in the question is from that template file. Googling now to see what you mean by 'magic'
    – jscar
    Commented Feb 1, 2019 at 11:08
  • Look for the file Social.php in your socail_links module, Block directory. That's your block class file.
    – HelgeB
    Commented Feb 1, 2019 at 11:11
  • OK, they are coming from core_config_data. They are set in System>Configuration>General>Social Accounts. All sorted now :)
    – jscar
    Commented Feb 1, 2019 at 11:14
  • thanks for the pointer to social.php - that helped me find the admin section :)
    – jscar
    Commented Feb 1, 2019 at 11:16
  • marking as correct answer because of the process for tracking down. I know the answer itself didn't directly solve it but I don't care - you helped.
    – jscar
    Commented Feb 1, 2019 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.