public function getElementOptionsHtml(BaseElementModel $element)
 {
     $isNew = $element->id === null;
     $locales = array_keys($element->getLocales());
     $settings = craft()->plugins->getPlugin('localeSync')->getSettings();
     if ($isNew || count($locales) < 2) {
         return;
     }
     return craft()->templates->render('localesync/_cp/entriesEditRightPane', ['settings' => $settings, 'localeId' => $element->locale]);
 }
Beispiel #2
0
 /**
  * Returns the editable locale IDs for a given element, taking user locale permissions into account.
  *
  * @param BaseElementModel $element
  *
  * @return array
  */
 public static function getEditableLocaleIdsForElement(BaseElementModel $element)
 {
     $localeIds = array();
     if ($element->isEditable()) {
         if (craft()->isLocalized()) {
             foreach ($element->getLocales() as $localeId => $localeInfo) {
                 if (is_numeric($localeId) && is_string($localeInfo)) {
                     $localeId = $localeInfo;
                 }
                 if (craft()->userSession->checkPermission('editLocale:' . $localeId)) {
                     $localeIds[] = $localeId;
                 }
             }
         } else {
             $localeIds[] = craft()->i18n->getPrimarySiteLocaleId();
         }
     }
     return $localeIds;
 }