/** * Render a social network identity * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); if (!$element instanceof \Rexmac\Zyndax\Form\Element\SocialNetworkIdentity) { return $content; } $view = $element->getView(); if (null === $view || !$view instanceof Zend_View_Interface) { return $content; } $name = $element->getFullyQualifiedName(); $options = array(); $networks = SocialNetworkService::find(); foreach ($networks as $network) { $options[$network->getId()] = array('label' => $network->getName(), 'class' => 'icon-' . strtolower($network->getAbbrev())); } $identityName = $element->getIdentityName(); $network = $element->getNetwork(); $markup = $view->formText($name . '[name]', $identityName, array()) . ' ' . $view->formSelect($name . '[network]', $network, array('class' => 'socialNetworkMenu'), $options); if ($this->getOption('link')) { $markup .= '<a href="javascript:;" class="addSocialNetworkFieldLink" title="Add another social network identity">[Add another]</a><br>'; } switch ($this->getPlacement()) { case self::PREPEND: return $markup . $this->getSeparator() . $content; case self::APPEND: default: return $content . $this->getSeparator() . $markup; } }