texts:
Here is my class:

<?php

namespace Drupal\mais\Form;

use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ChangedCommand;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\CssCommand;
use Drupal\Core\Ajax\InvokeCommand;
use Drupal\Core\Form\FormBase;
use Drupal\mais\Form\annuaireForm;
use Drupal\Core\Datetime\DrupalDateTime;

/**
 * Form controller for adhesion edit forms.
 *
 * @ingroup mais
 */
class adhesionForm extends ContentEntityForm {

    public function getFormId() {
    return 'adhesion_form';
    }

   /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    /* @var $entity \Drupal\mais\Entity\adhesion */
    $form['#theme'] = 'adhesion_form';
    $form = parent::buildForm($form, $form_state);

    $entity = $this->entity;

    //pour l'ajax
    if (!$form_state->has('entity_form_initialized')) {
    $this->init($form_state);
    }

    $form['add_annuaire'] = array(
       '#weight' => '-9',
      '#type' => 'button',
      '#value' => "Ajouter une fiche a l'annuaire",
      '#ajax' => array(
        'callback' => 'Drupal\mais\Form\adhesionForm::addAnnuaireCallback',
        'event' => 'click',
        'progress' => array(
          'type' => 'throbber',
          'message' => 'Création du formulaire',
        ),

      ),
    );
  /**
   * {@inheritdoc}
   */
  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this->entity;

    $status = parent::save($form, $form_state);

    switch ($status) {
      case SAVED_NEW:
        drupal_set_message($this->t('Created the %label adhesion.', [
          '%label' => $entity->label(),
        ]));
        break;

      default:
        drupal_set_message($this->t('Saved the %label adhesion.', [
          '%label' => $entity->label(),
        ]));
    }
   //$form_state->setRedirect('entity.adhesion.canonical', ['adhesion' => $entity->id()]);
    $form_state->setRedirect('view.intranet_adhesion.page_1', ['adhesion' => $entity->id()]);
  }
  public static function addAnnuaireCallback(array &$form, FormStateInterface $form_state) {

    $AddAnnuaireForm = \Drupal::formBuilder()->getForm('Drupal\mais\Form\annuaireForm');
    //return $AddAnnuaireForm;

    $ajax_response = new AjaxResponse();
    $ajax_response->addCommand(new HtmlCommand('#div-cible', buildAnnuaire));

   return $ajax_response;

  }

}

In the addAnnuaireCallback function,  the line

$AddAnnuaireForm = \Drupal::formBuilder()->getForm('Drupal\mais\Form\annuaireForm');

return an error:

Error: Call to a member function getEntityTypeId() on null in Drupal\Core\Entity\EntityForm->getBaseFormId() (line 79 of Drupal/Core/Entity/EntityForm.php).


texts: Migrate the MD5 passwords as it is without rehashing

texts:
I am trying to migrate data from a custom database which uses a different method to HASH the password.

password = md5(email + password + salt)

Berdir has suggested me to create a new authenticate service API to login user based on the old algorithm instead of Drupal 8 standard password hashing.

So, I want to migrate the MD5 passwords from a custom database  to be migrated as it is without Drupal 8 Migrate API rehashing it.


texts: Fieldable panels panes - add a default category when creating

texts:
With Fieldable panels panes is it possible to programatically add a default category for all reusable entities?

Im adding new instances as follows, but it would be great if I could hard-code or even just suggest a category for all panes of this type to be created under. This way the Panels IPE wouldn't be such a mess if (when) editors don't set a category and everything gets lumped into 'Reusable Content'.

function logic_pane_bundles_entity_info_alter(&$entity_info) {

$entity_info['fieldable_panels_pane']['bundles']['poster_pane'] =
array(
    'label' => t('Poster Pane'),
    'pane category' => t('Hello bundles'),
    'pane top level' => TRUE, // set to true to make this show as a top level icon
    'pane icon' => '',
    'admin' => array(
        'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type',
        'bundle argument' => 4,
        // Note that this has all _ replaced with - from the bundle name.
        'real path' => 'admin/structure/fieldable-panels-panes/manage/poster-pane',
        'access arguments' => array('administer fieldable panels panes'),
    ),
);

}

Many thanks!


texts:
I just started a new project where I aim to provide country Icons. I use two languages in my project. My default language is English, and my problem is that in some pages it works fine, but in some other pages the English language does not work. Also I have a problem as shown below in image:

So what am I to do and how can I remove the English cross text form here. I am new in Drupal.


texts: Why is the CSS rule that I applied via the CSS injector module not active on my mobile device?

texts:
I have a panel row with two regions and I wish to re-order the
display for mobiles. Below is what I wish to accomplish:

And I thought it would be as simple as the below css rule :

@media screen and (max-width:480px)
{
   .pane-2
    {
    display:block;
    }
}

But nothing happened with the above rules.

I am using the CSS Injector module to apply the above css.

Can anybody help me with this one?


texts: How to sort feed aggregator's items in Views according to its category? I have two category : infographics (category id = 1) and others (category id = 2). I want to show items from infographics first and then others, regardless the timestamp. Any idea?


texts: How to investigate drupal_http_request replying 'connection timeout'?

texts:
Suddenly, my drupal 7 website showed some problem: not able to connect facebook, not able to send mail, not able to contact captcha server. Investigating, i found out that drupal_http_request is reporting a -101 connection timeout error doing

drupal_http_request('http://www.google.it');

How do i investigate or solve the problem, even if it is a server problem? My website is running on ubuntu 14.04.


texts:
My site is on a wamp server.

I am trying to get my PDFs to show up as a thumbnail on my drupal 7 site. I have installed Imagemagick on my computer, i couldn't ever get it installed on my wamp (there was documentation that I found to that showed how to install php_imagick.dll onto my WAMP, but it was 3 years old and outdated), but it seems to work still.

I also have the PDFPreview module installed and configured (I ahve already gone to the configure page and saved), I have a file field set up to display with PDFPreview, but when I add pdfs to that field the preview is never made and I get this error from imagemagick

  Debug: ImageMagick error:
  convert.exe: FailedToExecuteCommand "gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/Windows/TEMP/magick-9444Bo7mqLVmy-3f%d" "-fC:/Windows/TEMP/magick-9444h3BNhyb-tcOP" "-fC:/Windows/TEMP/magick-9444N2vudAzMQqXY"' (The system cannot find the file specified.) @ error/delegate.c/ExternalDelegateCommand/480.
  convert.exe: PDFDelegateFailedThe system cannot find the file specified.' @ error/pdf.c/ReadPDFImage/797.
  convert.exe: no images defined `C:\wamp\www\MYSITE\sites\default\files\pdfpreview/24-Human Immunodeficiency Virus in Adults Testing algorithm 4-23-15.jpg' @ error/convert.c/ConvertImageCommand/3230.
  in _imagemagick_convert_exec() (line 500 of C:\wamp\www\MYSITE\sites\all\modules\imagemagick\imagemagick.module).

Has anyone had this error and been able to fix it?

If so how?


texts:
What is the duration of the 'NEW' tag that is being added when creating new content? How do I change it so it would last until the content is edited, after that the NEW marker would disappear.

You can find NEW marker in red in admin/content

I do not understand how this works, content added yesterday and today are all marked as NEW which is misleading. I'd like to be able to change it.


texts: Reorganize Language Switcher based on Country/Region

texts:
I'm working on a site with 34+ languages and will likely be expanding to more. With this many countries, a simple drop-down list can be difficult for usability. I would like to customize the language switcher so that I can categorize a language by region and country. I have seen this before, have created similar on other non-Drupal sites, but haven't seen anything like it for Drupal.

Example:

Europe

Germany

DE

Switzerland

DE
FR

etc.

I'm looking for either a module, or a head start on what I might do short of writing some custom PHP for the project.


texts: How do I access a view's results with a custom module?

texts:
I'm creating a module that will expose a feed of content (under certain rules) as a JSON response. I want to use a Drupal 8 view to construct a query for that set of content, since it is a complicated set of rules.

Is there a way to query a Drupal 8 view in a custom module and iterate over the results?

Note that I am not trying to modify the output of the View with PHP; I just read the results and package them into a JSON response in my custom module.

I'm looking for something similar to entityQuery where I can instantiate a view object, execute it, and then iterate over the nodes that are in the result set.

Most of the searching I've done here and on Google points to Drupal 7 answers (which might not be relevant to Drupal 8 code), or otherwise generic Drupal query examples (when I am specifically looking for the Views module).

As an example, I'm looking to be able to do something like this (pseudocode):

class MyCustomModuleController {

  public function getFeed() {
    $view = View::get('my_view_name');
    $nodes = $view->execute();
    $response = [];
    foreach ($nodes as $node) {
      $response[] = $node->getSomeField();
    }
    return $response;
  }

}


texts:
I have the following problem with drupal 6 and I am using the Login Tobogan module.  When an user creates a new account in Drupal, the user receives the respective email.  When the users click in the link for validate the account, the account is validated but appears the next error:

Unable to send e-mail. Please contact the site administrator if the problem persists.
You have successfully validated your e-mail address.

Thanks for your help.


texts: How do I write NULL values to the database using drupal_write_record?

texts:
I'm using drupal_write_record to update records in the database in Drupal 6, but it appears to skip null values entered into my integer fields and just leave the old value. I've also tried the string "NULL" with no success. Regular integer values work fine.

$record = array(
  'id' => ##my_id##,
  'int_field' => null
);
drupal_write_record('my_table_name', $record, array('id'));

How can I change 'int_field' back to NULL from an existing value?


texts: How can I have a page title different from the name of its menu link?

texts:
I have the following implementation of hook_menu in a custom module:

/**
 * Implements hook_menu().
 */
function employee_list_menu() {
    $items['employee-list'] = array(
        'title' => 'Employee list',
        'page callback' => 'employee_list_render',
        'access arguments' => array('view employee list'),
        'type' => MENU_CALLBACK,
    );
    return $items;
}

I also have a custom menu in which a menu item link is 'Staff' and the path is 'employee-list'. When I click on the 'Staff' link the page opens and the page title is 'Staff', but I want it to be 'Employee list'. How can I fix this?

Thanks


texts: Custom entity - BaseFieldDefinition for entity reference field

texts:
I want to create custom content entity, with entity reference field, and display it by views.

Reference field is defined by:

  $fields['category'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Category'))
    ->setSetting('target_type', 'taxonomy_term')
    ->setRevisionable(false)
    ->setCardinality(-1);
;

How I'm supposed to use this field in view, to display referenced term names ?


texts: How to get the standard text format widget for a custom field type?

texts:
I've created a custom field that loads content from a given URL. The content is rendered with the given input format. That works fine.

Currently, I just gabe a list of available text input using filter_formats and show this with a select widget. How can I replace this with the standard input format widget that is available underneath the node body textarea?

This is how it's done now:

/**
 * Implements hook_field_widget_form().
 */
function remote_content_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {

    $url = isset($items[$delta]['url']) ? $items[$delta]['url'] : '';
    $tformatter = isset($items[$delta]['tformatter']) ? $items[$delta]['tformatter'] : 0;

    $widget = $element;

    $widget += array(
        ...
    );

    $widget['url'] = array(
        ...
    );
    $widget['tformatter'] = array(
        '#type' => 'select',
        '#title' => t('Text format'),
        '#options' => _remote_content_create_format_options(),
        '#default_value' => $tformatter,
        '#description' => t('Choose the appropriate text format.'),
    );

    $element = $widget;

    return $element;
}

function _remote_content_create_format_options() {
    global $user;

    $formats = filter_formats($user);
    $options = array();

    foreach($formats as $f) {
        $options[$f->format] = $f->name;
    }

    return $options;
}


texts: How does Feeds decide if it is going to create a new (or update an existing) entity?

texts:
I am using Feeds to map a CSV file to user entities and have the "Update existing users" setting in place. Everything is going great, except for the Telephone field... as it currently stands, the Telephone module doesn't have support for Feeds.

There is a patch that works for saving a telephone number when creating a new user, but not when updating an existing user.

Here's a CSV example (excluding headers for simplicity) for a new user:

demo,demo@demo.com,1234567890

Here's a CSV example for updating that same user:

demo,demo@demo.com,4567890123

When changing the value of the telephone number in the CSV file, and running it through the importer again, Feeds (or someone else?) doesn't see any incoming changes to be applied, so it skips the import entirely saying:

"There are no new users."

I've been looking at the Feeds API to see what hooks are available, and thought hook_feeds_presave() would be a nice one, since it talks about "skipping" an entity, but this hook only gets fired when creating a new user.

The hook_feeds_before_update() function gets called each time, but I'm not seeing a way to indicate to Feeds whether or not a value has changed, and to proceed or skip.

I'm guessing I need to expand upon the patch with hook(s)/other to make a simple decision for Feeds, pseudo code e.g.

...
// If telephone number has changed, tell feeds its OK to update.
if ($feed_item_value != $entity->{$field_name}['und'][o]['value']) {
  $feeds->update = TRUE;
}
else {
  $feeds->update = FALSE;
}
...

How does a module, that provides a field, tell Feeds that it detects a change with the field's value and to update an entity? Or does feeds and the internal entity system automatically do this?


texts: A way to generate line charts where each dataset comes from a view with specific arguments

texts:
I've got a view which shows download count and playback count (for musical works). This view may be filtered on time intervals, and is capable of returning downloads and playbacks for this time interval only.

Now, I'd like to generate an "overview" which simply will be the product of this view but with different time intervals. I'd like the resulting table to be something like:

when         downloads  playbacks
last week    10         100
last month   50         287
last quarter 200        437
last year    1000       1836

Is there a way to achieve this without doing it as a specific module? Is there a module out there which is capable of collecting data from a view, putting it together and generate a table and possibly charts for that?


texts:
I'm trying to migrate entities from a D7 to a D8 site using this tut: http://www.metaltoad.com/blog/migrating-taxonomy-drupal-7-to-drupal-8

When I execute the migration I get the error:

  The "skip_process_on_empty" plugin does not exist.

And then it just hangs.

I have this in my migrate yml file:

parent:
    -
      plugin: skip_process_on_empty
      source: parent
    -
      plugin: migration
      migration: custom_taxonomy_term

I tried changing it to skip_row_on_empty but get the same error regarding "skip_process_on_empty".

Here's the contents of [mymodule]/config/install/migrate.migration.custom_taxonomy_term.yml

id: custom_taxonomy_term
label: Drupal 7 taxonomy terms
dependencies:
  enforced:
    module:
      - monster_migrate_7
migration_groups:
  - Drupal 7
source:
  plugin: custom_taxonomy_term
process:
  tid: tid
  vid:
    plugin: migration
    migration: custom_taxonomy_vocabulary
    source: vid
  name: name
  description: description
  weight: weight
  parent:
    -
      plugin: skip_on_empty  <--changed this per suggestion
      method: process
      source: parent
    -
      plugin: migration
      migration: custom_taxonomy_term
  changed: timestamp
destination:
  plugin: entity:taxonomy_term
migration_dependencies:
  required:
    - custom_taxonomy_vocabulary

And here's what I get when I try to execute it:

> drush migrate-manifest sites/all/modules/monster_migrate_7/manifest.yml --legacy-db-url=mysql://[user]:[pass]@localhost/monster
Running custom_taxonomy_vocabulary                                                                                [ok]
Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'custom_taxonomy_vocabulary'                                                                                [status]
Running custom_taxonomy_term                                                                                [ok]
The "skip_process_on_empty" plugin does not exist.                                                                                [error]
>


texts:
I want to create a slightly different version of the formatInterval function. Normally I do this:

echo \Drupal::service('date.formatter')->formatInterval($seconds);

I want the final string to say not "1 hour 40 minutes", but "1h 40m" instead, so I was thinking about making a subclass of the core's DateFormatter class, and just change the protected $units property to define what I want.

How do I do this elegantly in a custom module, "the Drupal way"?


texts:
Hey guys I have been troubled for quite some time on this issue, I know there is probably one straight forward solution but from all the tutorials I have seen and info on drupal, I have not solved my problem.

I need to have a block that gets results from blog content types with same taxonomy term and same 'source' field value, how would I get into doing this? I can only get the taxonomy with 'has taxonomy term ID' contextual filter, but cant get the other one to show up correctly.


texts:
I've been searching around, but I can not find a good explanation (or understanding) what the 'time' value in hook_cron_queue_info actually does, or how to set it to work properly.

From: https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_cron_queue_info/7

it is said that: 'time': (optional) How much time Drupal should spend on calling this worker in seconds. Defaults to 15.

I don't quite understand that. Does calling the worker mean time allowed to execute the cron queue job?
And does the next cron queue job starts after this time? Or when the previous job is completed?


texts:
I seem to be having a difficult time getting the Disqus module to work on my Drupal website. Installation is normal, I just can't get to Disqus configuration page. The configuration page is blank.

I want to know: Does Disqus have any tables? If it does: Can someone give me the table structure, to see if I can use it?


texts: Password confirmation before submitting a form

texts: I have a signature field uploaded in the user profile. So while submitting a form I need users to confirm with their login password to use the signature and copy it into the relevant field. Form gets submitted only the user inputs the correct password which will validate against active directory. Is there anyway we can do this.


texts:
Hi i'm trying to extend scheduler module forms. The one i need is  included as fieldset in node as extra field refer to image

/**
 *  Implements hook_form_node_type_form_alter().
 */

 function nodequeue_scheduler_form_node_type_form_alter(&$form, $form_state) {

    //This  node type configuration form with schedule options

    $form['scheduler']['nodequeue_sheduler'] = array(
      '#type' => 'fieldset',
      '#title' => t('Nodequeue Scheduler Settings'),
      '#collapsible' => FALSE,
      '#group' => 'scheduler',
      '#weight' => 10,
    );

   }

/**
 * Implements hook_form_FORM_ID_alter().
 */
function nodequeue_scheduler_form_scheduler_node_form_alter(&$form, $form_state) {

   //feldset or vertical tab for scheduler to ammend
$options = array (1,2,3);
// Adding few custom fields
$form['scheduler_settings']['publish_nodequeue'] = array(
 '#type' => 'fieldset',
 '#title' => t('Nodequeue Scheduling settings'),

);
$form['scheduler_settings'] ['publish_nodequeue']['schedule_nodequeue'] = array(
 '#type' => 'checkbox',
 '#default_value' => 1,
 '#title' => t('Add to nodequeue when published')
);

$form['scheduler_settings']['publish_nodequeue']['nodequeue_position'] = array(
 '#type' => 'select',
 '#options' => $options,
 '#title' => t('Position')

);
$form['scheduler_settings']['publish_nodequeue']['publish_on'] = array(
 '#type' => 'textfield',
 '#title' => t('Publish on'),
 '#maxlength' => 30,

);
// function scheduler_mail_form_scheduler_node_form_alter(&$form, $form_state) {
//    $email_enabled = variable_get('scheduler_mail_enable_' . $form['type']['#value'], 0);
//    if (!$email_enabled) {
//      return;
//    }

//    $node = $form['#node'];
//    $settings = _scheduler_mail_load($node);

//    $form['scheduler_settings']['scheduler_mail'] = array(
//      '#type' => 'fieldset',
//      '#title' => t('Email settings'),
//    );
//    $form['scheduler_settings']['scheduler_mail']['scheduler_mail_send'] = array(
//      '#type' => 'checkbox',
//      '#title' => t('Send an email notification when this node is (un)published'),
//      '#default_value' => $settings->send,
//    );
//    $form['scheduler_settings']['scheduler_mail']['scheduler_mail_address'] = array(
//      '#type' => 'textfield',
//      '#title' => t('Use this email address'),
//      '#description' => t('If left blank, email will go to the original author of this node'),
//      '#default_value' => $settings->address,
//      '#maxlength' => 255,
//      '#states' => array(
//        'visible' => array(
//          "input[name='scheduler_mail_send']" => array("checked" => true)
//        ),
//      ),
//    );
//    $form['#validate'][] = '_scheduler_mail_validate';
//    $form['#submit'][] = '_scheduler_mail_submit';
  }

I have found module scheduler mail and it alters the node type form and add some configuration fields as checkbox but not getting the form which is in node edit form . How do i do it in drupal 7


texts: Periodically set the userpoints for every user

texts:
I would like to set the user points of members of my site to an x amount at the start of each month.
What would be the best way for this?

The closest I found so far was this:
http://drupal.org/node/549640

There are a few issues with this though:
1. It adds 5 points, instead of setting it to 5 universally
2. It uses a while loop which can take long if there are a lot of users

I am thinking of a quick and dirty UPDATE SQL query that does this in one go.


texts: How to alter auto-complete exposed filter programmatically?

texts:
I created a views to show parent and child term together using autocomplete expose filter .. but its show only one child. I have same child for two different parent.but its show only one child.
how to change this programmatically using view query alter. I need such type:

Parent . Parent-1
           locality-1
           locality-2
         parent-2
           locality-2
           locality-4

I need such type of result on autocomplete expose filter.


texts: Edit content if (taxonomy) Country = United Kingdom

texts:
I have created a user, now I want to give him permissions so that, when he is logged in, he can view/see all the contents, but can't edit/publish/unpublish/delete them.

Of all the contents, he can view/edit/publish/unpublish/delete only those contents, that has United Kingdom as taxonomy term, for example something like.

Logged in user can see all the contents, but If any content has Country -> "United Kingdom", then give permission to edit/publish/unpublish that particular content?

I have already tried Taxonomy Access Control, but didn't help me. Either I couldn't see any content, or I could edit all of them.

I want to give permission based on Taxonomy term.

I think I will probably need to do bit of coding.

Help?


texts: How to use profile2 profile type in custom form?

texts:
I'm building a multi step sign up form for my drupal 7 website, so I want to use one of profile type from profile2 in first step.
For such purpose I'm using this code:

function personal_info_form($form, $form_state) {
    $form_state['profiles']['main'] = profile2_get_types('main');
    profile2_attach_form($form, $form_state);
    $form['#validate'][] = 'profile2_form_validate_handler';
    $form['#submit'][] = array('profile2_form_submit_build_profile', 'profile2_form_submit_handler');
    return $form;
}

But still getting error, you can visit this page to see the exact error
http://dev.BlindHelp.net/user/register . Any help?


texts: I'm using Link Click Count module.I want to sort the view content based count.how to list sort the content based on link click count.now It displayed the node 4 times if the count is 4.


texts:
I have followed the guide at http://befused.com/drupal/first-drupal8-module to create a simple Drupal 8 controller, and it works as described. Instead of printing "Hello World" I would like to create more complex HTML.
I found a guide that appears to step through what I need to do at http://jonathanpatrick.me/blog/safe-markup. I added hook_theme to my flot_d8.module file:

function flot_d8_theme(array $existing, $type, $theme, $path) {
  return array(
    'flot_d8_my_template' => array(
      'template' => 'my-template',
      'variables' => array(
        'variable1' => NULL,
        'variable2' => NULL,
      ),
    ),
  );
}

and created the my-template.html.twig file exactly as shown:

  This is the first variable: {{ variable1 }}.
  This is the second variable: {{ variable2 }}.

I'm guessing my problem is in the way I try to call the theme. My controller code is:

namespace Drupal\flot_d8\Controller;
use Drupal\Core\Controller\ControllerBase;
class Flot_d8 extends ControllerBase {
  public function content() {
    return [
      '#theme' => 'flot_d8_my_template',
      '#variable1' => t("First"),
      '#variable2' => t("Second"),
    ];
  }
}

Is this the correct way to print a
 to the screen? Do I need to register the template file in my info file somewhere?


texts: custom views slideshow tpl from unformatted list of views drupal 7

texts: I want to create a slideshow in the front page. the slide show must have banner image of particular content type of recent nodes. how should i achieve this? should i create a view and theme it?


texts: Change sort order of SOURCE STRING list at User interface translation page to alphabetical instead of date created

texts:
At the User interface translation page (/admin/config/regional/translate) the SOURCE STRING list seems to be ordered by creation date/time (it is for strings I add). Is there a "good" (non-hackish) way to change the order to alphabetical? I haven't found anything in the interface.

For those who wonder why I want this, I use interface translation in an unconventional way. Instead of putting literals like t("Choose your options") in my code, I put in a key like t('rsc-string-choose-options') [rsc is the name of my custom module]. Then as the translation, I put in "Choose your options". This allows me to use "keys" for all strings (literals, messages, titles, email body text, etc.). It's easy to look up my keys because they all begin with 'rsc-' followed by 'string', 'message', 'email', etc. depending on usage. Doing this provide a nice interface for editors to go in and change the text of the strings, since they can look them up either by translation or by key. I also wrote a nice utility that allows me to add, remove, rename, and test keys (i.e. translation strings). It's working very well, but it would make review much easier if the source strings were alphabetical.


texts: SQL insert in taxonomy_index doesn't work

texts:
I used the following code, but it doesn't work, and I get no errors.

$query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created'));
$query->values(array(
  'nid' => $node->nid,
  'tid' => 53,
  'sticky' => 0,
  'created' => time(),
));
$query->execute();

dvm($query);

if (!$query) {
  dvm($query);
}

The output of this code is the following.

$query = db_insert('taxonomy_index')
  ->fields(array('nid' => 27, 'tid' => 53, 'sticky' => 0, 'created' => time()))
  ->execute();

dvm($query);

if (!$query) {
  dvm($query);
}

This code doesn't output any error; dvm($query) outputs '0'.

$row = new stdClass();
$row->nid = 27;
$row->tid = 55;
$row->created = time();
drupal_write_record('taxonomy_index', $row);

This gives the same result of the previous code.

$arr[] = 55;

db_query('INSERT INTO {taxonomy_index} VALUES  (%d, %d, %d, %d)', 27, 55, 0, time());

It doesn't work; It outputs the following error message.

  Recoverable fatal error: Argument 2 passed to db_query() must be of the type array, integer given, called in D:\OpenServer\domains\boobon\sites\all\modules\backup_bike\backup_bike.module on line 214 and defined в функции db_query() (строка 2342 в файле D:\OpenServer\domains\boobon\includes\database\database.inc).

I have installed the Ubercart module.


texts: Listing the terms of a Taxonomy Vocabulary in a Tree structure using Views

texts:
I am on drupal7. I am trying to list all the terms of a vocabulary in a view. However the Taxonomy vocabulary has multilevel categories and subcategories.

  Is there any module to Show the list in a view so that Initially
  Parents will be displayed, then when hovered or clicked on parent all its child terms are displayed, if hovered or
  clicked on child its sub-child are shown.

I want to display the list in the sidebar first or in the header part of the front page .

Example:

Similar to the style how categories in Flipkart are displayed.

Any help!


texts: "managed_file" type element not showing in my custom block configure form

texts:
I have been creating a portfolio section for my one page theme and I created a module for these section blocks. Now, I'm using the hook_block_configure to set the data into the blocks.

Only 1 "#managed_file" type element is showing, the other 5 is not. I think they are in the same structure since I just copy/paste and edit some variables.

Here is my code:

 case 'portfolio':
      // For portfolio #1
      //dpm($portfolio);
      $form['portfolio_text_1'] = array(
        '#type' => 'textfield',
        '#title' => t('Enter your text portfolio'),
        '#default_value' => variable_get($portfolio['text'][0],'Category 1'),
        '#required' => TRUE,
      );
      $form[$portfolio['image'][0]] = array(
        '#type' => 'managed_file',
        '#name' => 'image1',
        '#title' => t('Choose an Image File'),
        '#description' => t('Select an appropriate image for the above portfolio'),
        '#default_value' => variable_get($portfolio['image_fid'][0],''),
        '#upload_location' => 'public://files/images/',
        '#upload_validators' => array(
          'file_validate_extensions' => array('gif png jpg jpeg'),
        ),
      );

       // For portfolio #2
      $form['portfolio_text_2'] = array(
        '#type' => 'textfield',
        '#title' => t('Enter your text portfolio'),
        '#default_value' => variable_get($portfolio['text'][1],'Category 2'),
        '#required' => TRUE,
       );
      $form[$portfolio['image'][1]] = array(
        '#type' => 'managed_file',
        '#name' => 'image2',
        '#title' => t('Choose an Image File'),
        '#description' => t('Select an appropriate image for the above portfolio'),
        '#default_value' => variable_get($portfolio['image_fid'][1],''),
        '#upload_location' => 'public://files/images/',
        '#upload_validators' => array(
          'file_validate_extensions' => array('gif png jpg jpeg'),
        ),
      );

// more in here.. but since portfolio image 2 file uploader is not showing it is still the same as below.

My global variable:

  static $portfolio;

  $portfolio = array(
    'text' => array(
      'portfolio_text_1',
      'portfolio_text_2',
      'portfolio_text_3',
      'portfolio_text_4',
      'portfolio_text_5',
      'portfolio_text_6',
    ),
    'image_fid' => array(
      'portfolio_image_1_fid',
      'portfolio_image_2_fid',
      'portfolio_image_3_fid',
      'portfolio_image_4_fid',
      'portfolio_image_5_fid',
      'portfolio_image_6_fid',
    ),
    'image' => array(
      'portfolio_image_1',
      'portfolio_image_2',
      'portfolio_image_3',
      'portfolio_image_4',
      'portfolio_image_5',
      'portfolio_image_6',
    ),

  );

NOTE:

The textfields are showing, only the other 5 image uploader are not.

How to make it show up?

Thanks for your responses.


texts:
I have an entityform that has a computed field.
In computed field,
I have to compute two time fields.

When I tried using this code that declares value for the two time field, it works fine

$timefrom = '06:00PM';
$timeto = '8:30PM';
$from = DateTime::createFromFormat('h:iA', $timefrom );
$to = DateTime::createFromFormat('h:iA', $timeto );

$ot_hour =  $to->diff($from);
$ot_minute =  $to->diff($from);
$hour = $ot_hour->format('%h');
$minute = $ot_minute->format('%i');
$hourtominute = $hour*60;
$total = ($hourtominute+$minute)/60;
$entity_field[0]['value'] = $total;

But when I used the variables from the entityform,

$timefrom_value = array_pop(field_get_items($entity_type, $entity, 'field_time_from'));
$timeto_value =array_pop(field_get_items($entity_type, $entity, 'field_time_to'));

$timefrom = $timefrom_value['value'];
$timeto = $timeto_value['value'];
$from1 = DateTime::createFromFormat('h:iA', $timefrom );
$to1 = DateTime::createFromFormat('h:iA', $timeto );

$ot_hour =  $to1->diff($from1);
$ot_minute =  $to1->diff($from1);
$hour = $ot_hour->format('%h');
$minute = $ot_minute->format('%i');
$hourtominute = $hour*60;
$total = ($hourtominute+$minute)/60;
$entity_field[0]['value'] = $total;

It show error "Fatal error: Call to a member function diff() on a non-object"

Why is this happening?
I need some help to solve this. thanks a lot!


texts: Drupal 7 set default value from database in hook_form

texts:
I have implemented a hook menu:

$menu['question-view'] = array(
  'title' => 'Question View',
  'page callback' => 'item_view',
  'access arguments' => array('access question view'),
);

item_view callback is generated using table theme:

$output = theme('table', array(
  'header' => $header,
  'rows' => $rows,
));

$output .= theme('pager');
return $output;

which displays a table like this:

Question            Edit
Question1     Click here to edit
Question2     Click here to edit
Question3     Click here to edit

where "Question1", "Question2", and "Question3" are just questions like "What is your name?", which were all obtained from questions table in database.

When I click "Click here to edit", it should go to a form containing that question. For example, when I click edit beside Question2, the form should display Question2 as default value in the $form['question'] field.

I want to do something like:

$form['question'] = array(
  '#title' => t('Question'),
  '#type' => 'textfield',
  '#default_value' => ... // This should come from the question where I clicked.
);

Question:
How should I set the default value of $form['question']?


texts:
I have added twig suggestion from .theme file to views__view.html.twig for customizing taxonomy.

   function mediumish_blog_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
      if (\Drupal::routeMatch()->getRouteName() == 'entity.taxonomy_term.canonical' && $tid = \Drupal::routeMatch()->getRawParameter('taxonomy_term')) {
       $term = Term::load($tid);
       $suggestions[] = 'views__view__taxonomy_term';
     }
   }

I am getting suggestion in twig suggestion display but when i am creating file and applying my custom theme, its not actually displaying output of that file, Its still using the default views--view.html.twig.


texts:
Drupal 8.7.x

I have a Form button with a confirmation page to delete an ingredient. I'm trying to convert it to a standard Form that just deletes it without confirmation, however I keep getting an error.

Confirmation Form (works just fine) src/Form/DeleteIngredient.php:

 <?php

namespace Drupal\recipe_search\Form;

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Url;

/**
 * Class DeleteIngredient
 *
 * @package Drupal\recipe_search\Form
 */
class DeleteIngredient extends ConfirmFormBase{

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'delete_ingredient';
  }

  public $cid;

  public function getQuestion() {
    return t('Do you want to delete %cid?', array('%cid' => $this->cid));
  }

  public function getCancelUrl() {
    return new Url('recipe_search.recipes');
  }

  public function getDescription() {
    return t('Only do this if you are sure!');
  }
  /**
   * {@inheritdoc}
   */
  public function getConfirmText() {
    return t('Delete it!');
  }
  /**
   * {@inheritdoc}
   */
  public function getCancelText() {
    return t('Cancel');
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state, $cid = NULL) {
    $this->pid = $cid;
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

    $database = \Drupal::database();
    $database->delete('ingredient_list')
      ->condition('pid', $this->pid)
      ->execute();

    $form_state->setRedirect('recipe_search.recipes');

  }

Tried this for normal form without confirmation src/Form/DeleteIngredient.php:

<?php

namespace Drupal\recipe_search\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Class DeleteIngredient
 *
 * @package Drupal\recipe_search\Form
 */
class DeleteIngredient extends FormBase{

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'delete_ingredient';
  }

  public $cid;

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state, $cid = NULL) {
    $this->pid = $cid;
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

    $database = \Drupal::database();
    $database->delete('ingredient_list')
      ->condition('pid', $this->pid)
      ->execute();

    $form_state->setRedirect('recipe_search.recipes');

  }
}

This is where I return the form to the twig template src/Block/RecipeSearch.php:

//FETCH THE INGREDIENTS TO MAKE AN API CALL
$result = $connection->select('ingredient_list', 'il');
$result->fields('il', array('ingredient', 'pid'));
$result->condition('uid', $uid);
$data = $result->execute();
$results = $data->fetchAll(\PDO::FETCH_OBJ);

foreach ($results as $field) {
  $delete = Url::fromUserInput('/delete/'.$field->pid);

  array_push($ingredients, ["ingredient" => $field->ingredient, "delete" => $delete]);
  array_push($ingredientsArray, $field->ingredient);
};

This is the Error I'm getting:

  Error: Cannot call abstract method
  Drupal\Core\Form\FormInterface::buildForm() in
  Drupal\recipe_search\Form\DeleteIngredient->buildForm() (line 32 of
  /var/www/html/web/modules/custom/recipe_search/src/Form/DeleteIngredient.php)

I guess you cannot use buildForm while extending FormBase but I don't know how I should solve this.

Thanks in advance!


texts:
I got a panel and added a comment form for this certain node type but the comment form does not show up.

I have enabled commenting for this content type and appropriate permissions (can post comment) for any authenticated user.
I tried disabling the panel for node templates.

In both case the comment form still does not show up.
What could be wrong?


texts:
in a command I have the 1288 revision, 1498, 1499, 1500 I want to restore the 1288 revision and remove the 1498 revision, in 1499, 1500 can I do this in my database?

Thank you


texts:
I find some bugs in a contrib module I have fixed them and I want to commit my change to that module ,what is the right procedure to do that .

I did this is that ok.

create a new drupal site instlation.
cd to the module folder then clone the module git inside it (following the Version control instruction page)
I have fixed the problem , then commit and push to the git repo.

the problem with this method is that I can't explain the problem in detail with a just a commit so should I open a module issue in drupal website and link it to my commit ?


texts: Is it possible sorting a table with non-database driven data?

texts:
I am creating tables, using data from services. This data is not stored in a db.

But while I have been able to theme it using tableselect, I can't get sorting to work. Adding sort on fields, expects me to also integrate that to a query, for things to work. So even though I get the ascending and descending arrow, the data is not actually being sorted.


texts: Why can I choose the widget for grouped filters, but not exposed?

texts:
When I create a view (block) and create an exposed filter I have the choice of a Filter type to expose between

Single filter and
Grouped filters

If I choose the Grouped filters I am presented with an option to chose the Widget type

Radios or
Select

But if I chose the default Filter type the form lacks the Widget type option.
I cannot think of any reason why the regular exposed filters shouldn't have this widget type option to chose from.
Can anyone tell me ...

Is there a reason for this?
Is there any patch that I didn't find until now that fixes this/add's the feature?

FYI:
There is a hard coded switch in the Drupal core which automatically changes the widget type from checkboxes/radios to select based on the number of options regardless of the Widget type settings in the views form (1-4 options: radios, 5+: select). That issue is patched here: Grouped exposed filter with "Allow multiple selections" ignores widget setting
Edit
I don't want the alpha version of Better Exposed Filters module like suggested by some.


texts: Drupal 7 LoginToboggan username or email or custom field

texts:
I have a Drupal 7 site and the client wants the user to be able to login using: email or username or a custom_field that's unique to each user.  I've scoured for solutions but can't find any.   Any help would be appreciated.  I'm using Logintoboggan to handle username or email, but can't find anything to validate and allow authentication for a custom field.

Thanks!


texts: Is there a D7 module that allows you to create a content type to be displayed as a system message?

texts:
Is there a D7 module that allows you to create a content type to displayed as a system message?

Something like http://drupal.org/project/user_alert but gets displayed in the system messages.


texts: Drupal 7 module recommendations for mailman listserv?

texts:
From what I've seen the only mailman integration module is Mailman Manager which is only D6.

Does anyone know of another module or any other tool that I could use to implement the same functionality for D7? I.e.:

administer the lists
allow users to subscribe
unsubscribe
etc ...


texts: Programmatically add existing image to new node?

texts:
I am creating a new node with an image field. The code I am using to create the node is this.

$node = Node::create(['type' => 'leadspace']);
$node->setTitle('Node Title');
$node->set('field_background_image', [
    'target_id' => 391
]);

I have an image that has the target_id of 391 used on another node, and it is showing correctly. For the node I am creating, the image is not assigned correctly.

I have also tried, but it doesn't work either.

$node = Node::create(['type' => 'leadspace']);
$node->setTitle('Node Title');
$node->set('field_background_image', [
     [
        'target_id' => 391
     ]
]);

I also get the following errors for some weird reason but only get it when I am setting the image field, if I comment out the image field method the node is created all fine without any problems:

A fatal error occurred: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'projectName' in 'field list':
INSERT INTO {file_usage} (fid, module, type, id, projectName) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4);
Array
( [:db_insert_placeholder_0] => 391 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 11524 [:db_insert_placeholder_4] => 1 )

How can I programmatically add images that are already on the server to new nodes? Where is fatal error coming from?


texts: What is the maximum number of elements allowed in a form?

texts: I have googled and binged and yahooed this question but can't seem to find an answer. I was working on a form that included over 800 fields but the form's submit function would never execute.  After I pared the form down, the submit function ran.  So now I'm curious if there's an actual built in maximum number of elements.


texts: Hide Specific block when search is performed with Expose Filters in Drupal 8.8

texts:
I have made a custom view which will show Results based on the selected expose filters.

I can access that VIEW on my local machine as:
http://drupal881/home

On leftside bar, I have some filters and when I select any filter it will display results with ajax on the same page.Above Search results I have another BLOCK. I want to hide that block so that expose filter results will be seen on top.

What is the correct way to do this. Need help please.


texts: Does superfish module support multiple languages?

texts: Does superfish module support multiple languages in drupal 7?  From the CMS, I seem to be able to translate each menu item into english and french.  But Superfish is only outputting the english version of the menu.  So does superfish handle multiple languages?  If it does, how do I enable it?


texts:
What database table in Drupal 8 replaces variables table in Drupal 7?

Where are the values of Configuration stored?

example : $config->set('message', 'Hi')->save();
Where can I find value of message variable in database?


texts: Where is the "sites/all" folder for an ubuntu linux installation?

texts:
I have installed drupal 7 from the ubuntu repositories.  All works well but I cannot locate the folder to install additional modules.

All the documentation says I need to upload files to the "sites/all" folder. This either doesn't exist or is somewhere I have yet to look.

Any pointers would be much appreciated.

ETA: I had to create the "/all/modules/contrib" subfolders manually, under the "/usr/share/drupal7/sites" absolute path.


texts:
Using profile2, I created a profile, and it works fine.  I want to list content authored by that user on that profile page.  So, I created an EVA view, and I can't seem to figure out the right contextual ID configuration.  I tried a few several combinations to no avail.  What may I be missing?

The overall purpose is to display a profile page for users, along with a listing of their content they authored, using Display Suite (yes, the EVA field is visible).  I figured this would be the most simple way to build a profile page.


texts: user_presave doesn't work correctly when new account is created

texts:
My users have 2 fields: 'A' and 'B'. The value of the second one depends on the value of the first one and is set by the following custom module:

function MYMODULE_user_presave (&$edit, $account) {
    $tid = $edit['field_A']['und'][0]['target_id'];
    if (isset ($account->roles[3])) {
        $B = taxonomy_term_load(8);
        }
        else {
            $B = taxonomy_term_load($tid);
        }
    $edit['field_B']['und'][0]['fid'] = $B->field_B['und'][0]['fid'];
}

It works fine, but when an anonymous user registrates himself/herself, it fails: the if is evaluated as true and the new user gets the wrong value in 'B'. When I commented out the if and only left over the else action, it did work, so it has something to do with the $account.

What's going wrong and how can I solve this?

Note: role 3 is the built-in administrator role.

Edit: This is my final code after @m1n0's answer:

function MYHOOK_user_presave (&$edit, $account) {
    $tid = $edit['field_A']['und'][0]['target_id'];
    if ($account->is_new OR !isset ($account->roles[3])) {
        $B = taxonomy_term_load($tid);
        }
        else {
            $B = taxonomy_term_load(8);
        }
    $edit['field_B']['und'][0]['fid'] = $B->field_B['und'][0]['fid'];
}


texts: I am using custom breadcrumbs and almost all is working well but a few issues. One problem stated in another question, this problem is that on the landing page of my views I am getting home >> Homme >> Homme. I need to remove the duplicate. I see there is a form in the configuration for breadcrumb visibility. Is this where I solve this problem. I see no other way to do this. Does anyone know or have the code I need?


texts: Caching mysql results in cache table to be retrieved later

texts:
How can i fetch records from mysql results stored in cache table ?

$cached_res_obj = cache_get("expensive_sql", MY_CACHE_TABLE);
$res            = $cached_res_obj->data;
while ($row = db_fetch_array($res)) {
    print_r($row);
}
die(__FUNCTION__);

I dont get any results. If i run the actual query through drupal I get results.
What should be done here ?


texts:
Hello i hope someone can help me with this on here as i posted on drupal.org and folks told me it wasnt a drupal issue. I dont mind learning stuff but ive got so much drupal things that i do know about to get on with to get my site open that i dont want to spend a week trying to learn more about databases. All help appreciated. thanks.

My hosting company upgraded their servers the other now. Now my statistics module is all messed up and it's asking me to repair a table. The error message is-

  User warning: Table './onlineba_d939/node_counter' is marked
  as crashed and should be repaired query: SELECT totalcount, daycount,
  timestamp FROM node_counter WHERE nid = 4389 in _db_query() (line 148
  of /home/onlineba/public_html/includes/database.mysql.inc).

and

  User warning: Table './onlineba_d939/node_counter' is marked
  as crashed and should be repaired query: SELECT node.nid AS nid,
  node.title AS node_title, node_counter.totalcount AS
  node_counter_totalcount FROM node node LEFT JOIN og_ancestry
  og_ancestry ON node.nid = og_ancestry.nid LEFT JOIN node
  node_og_ancestry ON og_ancestry.group_nid = node_og_ancestry.nid LEFT
  JOIN og_uid og_uid ON node.nid = og_uid.nid LEFT JOIN node_counter
  node_counter ON node.nid = node_counter.nid WHERE (node.status = 1)
  AND (og_uid.uid = 1) ORDER BY node_counter_totalcount DESC LIMIT 0, 10
  in _db_query() (line 148 of
  /home/onlineba/public_html/includes/database.mysql.inc).

I have access to PHPmyadmin and i have a very very basic understanding of it. Is there a line of code or query i need to put in it to repair? I should go look maybe there is just a repair button. I think i saw that before. Anyone offer me any help before i destroy everything?

thanks


texts: How to group taxonomy terms by their parent when using term reference field?

texts:
Is there a way to group taxonomy terms by their parent name(as fieldsets) for term reference field in content creation?

For example: Cat#1 as parent and subCat#1, subCat#2 as children should be shown as a fieldset with Cat#1 as legend(and thus unselectable) and subCat#1 & subCat#2 should be shown in this fieldset.


texts:
I am trying to produce a view with exposed filters, where:

The options are listed as text links, like a menu
The page automatically updates when a link is clicked
jQuery effects appear to seamlessly 'reorder' and remove items smoothly

eg: http://thisiseyeweb.co.uk/our-work#filter=.e-commerce

I have solved 1 & 2 by using Better Exposed Filters and settings in Views. So I can produce the list of links that make up the menu, and the ajax action to change what is displayed. But I can't make items that should no longer display 'fade out' or remove themselves in a prettier fashion, like the link above.

Many thanks.


texts: Show sharethis twice on a page with different layouts

texts: I'm using Sharethis, is there any way to show sharethis as horizontal counter on the articles content type teaser display and then show it as large chicklets on a block?


texts: Invalid node context using ContextAwarePluginInterface

texts:
I am trying to create a block in Drupal 8 that would help me to show an image using a link given in a certain content type link. I tought it would be useful to use the ContextAwarePluginInterface.
I tried a simple example:

namespace Drupal\image_view\Plugin\Block;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;

/**
 * Currently this is a block with a simple text
 *
 * @Block(
 *  id = "image_view_block",
 *  admin_label = @Translation("Link to Image"),
 *  context = {
 *      "node" = @ContextDefinition("entity:node")
 *  }
 * )
 */
class LinkToImageBlock extends BlockBase implements ContextAwarePluginInterface{
    /**
     * {@inheritdoc}
     */
    public function build() {
        $context = $this->getContextValue("node");
        return [
            '#markup' => $this->t('Simple Block text. This will be an image, ha ha!'),
        ];
    }
}

If I comment the following line everything works fine.
$context = $this->getContextValue("node");

What would cause this? I tried to look it up but didn't find any answers.


texts:
I want to migrate all my content from my old D7 website to my new D7 site, with the Features module I exported/imported all my custom views, fields, etc.

But I don't understand how to export content.

Is there a way to do it from PHPMyAdmin? My two sites are on the same host. I have zero content in the new website. Can I overwrite the tables?


texts: Is it possible to use a different theme for just a section on the page?

texts:
In Drupal 7, using a different theme on each page is easy, but what I could really use in this particular case is 2 themes on the same page.

Let's say I want to use Rubik theme for all page sections (menu, etc.) except 'content' section, where I'd like to use Stark theme.

Is this possible at all? If it is, how?


texts: Tags for content type and search by this tags

texts:
i created a vocabulary called "Tags" and then a field on my content type using this vocabulary. I can create my content and add the tags, but then i search for the tags that im using and i get no results on the search. Somebody can help me? Thanks!
Drupal 7.44


texts: Making geolocated latitude/longitude values available to computed field in Drupal 7

texts:
I'm working on a D7 project where I need to pass a latitude/longitude value from a Location field (acquired from geolocating during import) to a Computed field.

I found the following code in the computed field documentation, which loads the field into the computed field:

$field_info = array_pop(field_get_items($entity_type, $entity, 'field_geo'));

However, if I do a dpm($field_info); all location information is there, EXCEPT lat/long.

Any way around this? Thanks!


texts:
I want to output all the node IDs which belong to a taxonomy term ID. I use the following code in page--taxonomy.tpl.php.

$a = taxonomy_select_nodes(arg(2), $pager = TRUE, $limit = FALSE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC'));

When on the parent term page, print_r($a) shows an empty array. Why does this happen?

Under the parent term, there are two child terms which have some articles. How do I get the node ID?


texts:
I need to send some e-mails depending on some actions. These e-mails should be translated depending on the target user's preferred language. I've seen that the mail function has a language parameter, but for me, it's not really do anything.

  $renderArray = [
    '#theme' => 'email_notification_content_update',
    '#name' => $node->getOwner()->getDisplayName(),
    '#content_title' => $node->getTitle(),
    '#content_url' => $node->toUrl('canonical', ['absolute' => TRUE])
      ->toString(),
    '#unfollow_url' => Url::fromRoute('flag.field_entry.delete', [
      'flag' => 'flag_name',
      'entity_id' => $node->id(),
    ])->setAbsolute()->toString(),
  ];

  $this->mailManager->mail(
    'my_module',
    'email_notification_content_update',
    $follower->getEmail(),
    $follower->language()->getId(),
    [
      'body' => $this->renderer->renderRoot($renderArray),
      'subject' => $this->t('An update of the content @title has been updated.', ['@title' => $node->getTitle()]),
    ]
  );

Currently, the e-mail text is in twig file (with links) and the parameters are passed to it at render. Now I can put the whole twig file in {% trans %} tags, but is there a better way? Like using the mail function's language parameter? Is there a better way to make a custom e-mail sending and have translations to them?


texts: How to save autocomplete and date type fields while adding node programmatically?

texts:
I am creating a node programmatically and I have a field which is autocomplete and has number of values set to unlimited.

In the code for adding the node programmatically ,the code is as given below

    $node->field_user[]['value'] = $user->name;
       $node->field_time[]['value'] = date('m-d-Y H:i', REQUEST_TIME);
  $trans_node->field_download_flag[0]['value'] = 'YES';

So after programmatically creating a view when I check into the 'find content' place I see a node being generated but when I click on the link(where the content title is )( not on the edit link) , I cannot see the field_user in the view list

field_time
type: date
widget : popup calendar
no of values : unlimited.

field_date
type: Entity Reference
widget : Autocomplete
no of values : unlimited.

field_flag
type: boolean
widget : checkbox/radiobutton
no of values : unlimited.

I think the code for field_user should be as

$node->field_user[]['target_id'] =  $user->name;

but still i am getting error that is WSOD


texts: How can I have editors select which blocks to be displayed in what order per page?

texts:
I have taken on a site that has hard coded page urls in it's page.html.twig for loading specific sidebar blocks based on the url for related content.
eg:

  {% if 'frozen' in url|render|render %}
              {# shows these blocks and in this order #}
              <aside id="sidebar">
                  {{ block_chooserecipes }}
                  {{ block_healthbenefits }}
              </aside>

Is there a way to create a content type field that will load the sidebar blocks that the editor wishes to include with their main content?


texts: Create a reference all available block content

texts:
In Drupal 7 there is Block Reference field module that can reference pretty much all available blocks, including views' blocks, system blocks, menu blocks etc.

I'm just starting with Drupal 8 and since the Block Reference module doesn't have a version for it, and the built-in Entity Reference doesn't seem to pick up views' blocks, system blocks, I want to create a new custom block type. In this new block type, I want to have a reference field that can reference all available block content.

Is there a way to do it?


texts: How can I get a display name from the view ID and display ID?

texts:
I can load a view with $view = Views::getView('my_view_id');, but how do I use that object to load the display_title or say an array containing information including the display name?

Note: This is not to be confused with loading the display's title that might be used when printing the view, as there's a method for that (getTitle()).


texts: Getting og membership type in template.tpl.php

texts:
I want to obtain the organic groups role-id of a node/comment-author in node.tpl.php and comment.tpl.php.

I can't find an array that provides this information.

I want to add a class based on the authors membership type.

Dummycode:

<div id="header" class="<?php if ($author->rid == 7): print 'class-7'; endif; ?>">

How to do this for nodes and comments?

Note: for normal (non-organic-group) roles I use:

<?php if(in_array('administrator', $user->roles)): print 'admin-type'; endif; ?>

Which works ok, I want similar usage for organic group roles.


texts: Sending file attachment in the email contact form

texts: I have added a file field in a contact form. The client is receiving the email and there is the link of file. She now needs the file in attachment. Is there any module or code that could send the contact form field now in the attachment? I have searched but couldn't find something yet. Many thanks!


texts: Citation and question marks works fine in title in a node, but not in a view

texts:
I have to be able to use citation and question marks in a node title. It seems to work fine in the node and in the content manager, but the view that lists the nodes does not show it correctly.

" becomes &quot;
& becomes &amp;

Why does it not work in views, and how do I resolve the issue?

Cheers,
Daniel


texts: Write permission for file system in Pantheon hosting

texts:
I am using three different kind of environments like Dev, Test, and Live under Pantheon hosting.

The file systems for Dev and Test are working fine and those have write permissions too. When I try to give the write permission for the Live environment, it shows a permission denied error.

It shows the temp directory doesn't exist, but the temp directory is there in my server. I don't know how it happens. Can anyone give the solution for that?


texts: Search node by Image Field and return image as result rather than the node

texts:
I want to be able to search for a an item in a multiple value field of a node and return the data of that specific value as the result.

I have a content type called 'Gallery'.  'Gallery' contains an image field that allows for unlimited values.  Each value has an alt value that is exposed to Search API.  I have a view using the "Search Views" module to filter the results from Search API.

I can successfully search for any 'Gallery' based on any of the alt tags of any of the images. The necessary data is exposed as fields to my view, such as:
Gallery Photos: The image file. (indexed) |
Gallery Photos » The image file.: File ID (indexed) (File ID (indexed))

but these fields only return data for the first image of that field in the Gallery.

I've searched high and low for a module or hack solution.  No one has seemed to solve this.  This seems like an important feature, because the way things are looking now, I would have to store each image as a separate node to be able to search for it individually.  And that doesn't make sense for a lot of reasons.

Any help or direction would be greatly appreciated.


texts: Set blank vale as default for a select box using Drupal form API?

texts:
I'm building a form in a module using the Drupal Form API (Drupal 6) and have it mostly working, however I have a few required fields but don't know how to set a blank or null first selection option so the user will be forced to select an option.  Here's an example of my code using my country select box:

$form['address']['country'] = array(
    '#type' => 'select',
    '#title' => 'Country of Residence',
    '#options' => get_country_form_array(),
    '#required' => true
);

Here's the get_country_form_array() function:

function get_country_form_array() {

    $countries = variable_get('form_countries');

    $output[0] = 'Select a Country';

    foreach ($countries as $country) {

        $output[$country[0]] = $country[1];

    }

    return $output;

}

How do I add a blank first option to force a selection by the user?


texts: Content type disappear when cache is cleared

texts:
Lately, every time I clear the cache, my content types are systematically deleted. I use Drupal 7.36.

The main plugins I use are the following:

Views 3.10
Chaos Tools 1.7
Entity API 1.6 and others.

When I'm on Drupal 7.34, I don't have this problem. Maybe I should update the 7.34 version to 7.35 then 7.36

Have you any idea ?


texts: Use an image instead of a menu link in Drupal 7

texts: I have a menu in my page that I have created. I have a link called 'Home', and I want an image to be there for only this link. I saw many modules for Drupal 6. Is there any hook or module in Drupal 7 to do this?


texts: I exported a .enw file from Biblio in drupal 6 and am attempting to import it into my drupal 7 site. However on the "data import" tab, "choose file" is grayed out and disabled. What needs to be done to import the drupal 6 biblio nodes?


texts: Media Gallery module field settings stored in database?

texts:
I have installed the Media Gallery module for someone's site to upload fotoalbums with; it's need to add a file size restriction because quite a bit of pictures are coming in.
I can't tell what the exact error is in English; the site's language is Dutch. When I want to edit fields in my Media Gallery content type, I get a message that says the settings are stored in the database, locked and I can't change those settings anymore.

Update: There is a similar issue at Drupal.org; it looks like it isn't possible. Or is it?


texts: cache issue - misaligned views cached output

texts:
I am trying to set the view on the home page.
http://www.userbase.com/

The content gets misaligned for anonymous user. I can see proper output if I am logged in.

Any ides?

I am using following cache plugins:

Block Cache Alter
Render cache
Render cache for comments added to a node
Render cache for display suite views integration
Render cache for node_show
Render cache for views_plugin_row_node_view
Safe cache_form Clear


texts: Programmatically add custom meta description via metatag module

texts:
I'm trying to add a custom meta tag description for a custom module using the metatag module.

I tried this without success:

function mycustommodule_metatag_metatags_view_alter(&$output, $instance) {
  if ($instance == 'mycustom:entity') {
    $output['description']['#attached']['drupal_add_html_head'][0] = array(
      array(
        '#tag' => 'meta',
        '#name' => 'desription',
        '#value' => $my_custom_description,
      ),
      'description',
    );
  }
}


texts: What are Text Filters and Input Formats?

texts:
In views, when I add a field of type body, there are some options given: text_default, text_plain, text_trimmed.

How do these options filter the contents of the field and where can they be found in the code??


texts: How to filter a view from within a paragraph ideally using url?

texts:
I have a basic page that contains a paragraph which has the following field:
Label = News View
Field Type = Views Reference (reference method = default)

This references a view that has a contextual filter for nodeId. If I set a static value in the paragraph argument (e.g 14), the basic page displays as I want (with the view filtering on NodeId=14).

However, I want this page to filter differently depending on what is in the url (e.g /news/14   or /news/15 etc)

Could anyone please tell me how to do that?

What I am actually trying to achieve (just for reference, not required to solve issue):
A news page that has a paragraph that can be loaded at /news or /news/14.
If no number is specified, the page loads the view with no filter. If a number is specified, the page loads the filtered view. The reason I am using paragraphs is that I am actually showing multiple paragraphs each with a different view here, but they all want the same value (or no value) so a solution for one paragraph will suit all.


texts: Git workflow for Composer-based projects

texts:
I would like to install/manage Drupal with Git, Drush, and configuration synchronization.

Should I add core/ and vendor/ into the .gitignore so that instead of pushing/pulling core I simply update core on prod/dev and synchronize configuration only?

This way I could potentially manage a Drupal site with few repositories:

Repository for configurations
Repository for a custom theme
Repository for custom modules

When updating a module, this would be my workflow.

On development

git pull
drush up
drush config-export to-prod
git push

On production

git pull
drush up
drush config-import to-prod

I ask because it doesn't seem to make sense that I have to push/pull all of Drupal 8 with every update.


texts: Where do I find the block id for Twig Tweak module

texts:
In order to print a block in a twig file when using the Twig Tweak module you require the block id, but nothing I am trying will work and I get the message that -

This block is broken or missing. You may be missing content or you might need to enable the original module.


texts: Retrieve taxonomy terms with EntityFieldQuery for a given parent term

texts:
I am retrieving a tid of a taxonomy term by using EntityFieldQuery. However, I need to cross-link the taxonomy_term_hierarchy table to list those terms which have a particular parent, but I am not able to get it. In the code below

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'taxonomy_term')
      ->propertyCondition('vid', $vocabulary)
      ->propertyCondition('name', $termino)
      ->propertyCondition('parent', $parent_id)

the last line is throwing the following (expected) error. The same code, without the last property condition, works correctly. How can I achieve the result?

The returned error is:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'taxonomy_term_data.parent' in 'where clause'


texts: How to access the links variable from a template?

texts:
I have created a views template for a block and I would like to insert the list of links that normally appears at the bottom of teasers and/or pages (the $links variable) into the template like it is done in page.tpl.php.

However I can't find how to get this information given a node's id.

How do I accomplish this? Is there a Drupal 7 command that accomplishes this?


texts: Running functional tests on a non-English site

texts:
When creating functional tests (extending BrowserTestBase) for a D8 site, how would I go about changing the default language of the site being temporarily created by BrowserTestBase?

I'm trying to run tests on a site in a non-English language, and I'd like to avoid confusion by using English terms etc. in test cases.

As far as I see, Drupal/Core/Test/FunctionalTestSetupTrait.php sets the default langcode to be 'en' (in the installParameters method) and there's no option to specify custom installation parameters. Besides hacking this manually, is there a more elegant, "proper" way of changing this behavior?

If that's not possible, then would it be possible to change the site's language after it's created, maybe in the setUp method of the test class?


texts: Override Entire Module Page using Template

texts:
I would like to override the entire page created by my custom module, I've used the hook_theme function but my template only affects the markup within the content region, I need to define the markup of the entire page inside the template file, including the header footer etc.

I know that this can be done in the theme but I need to to keep the template file within the module itself.


texts: i want to use the INSERT module, to be abel to insert images into my content in a WYSIWYG style. I have downloaded & installed colorbox, have added a new field to my content type that allows me to upload images, I have installed CKEditor and Insert but when I upload a image in my added field, I do not get an insert button to place the image into my content. What am I missing?


texts:
I'm not too new to Drupal and working on modifying a module.. but I'm trying to figure out how a module builds it's form.
But can't seem to figure out how it's built. What methods can I use to trace it.


texts: Display Empty taxonomy terms using views

texts:
Hi I am displaying my taxonomy terms using views having a reverse node relationship added, I am able to display the taxonomy terms having nodes associated with it, but I am not able to display the empty terms which have "0"zero count.

I need to also display the empty terms. I have enabled the aggregation for node counter. Help will be greatly appreciated.

I am using views version 3. Actually this question is related to this link also

Taxonomy Terms node count of different content type

This solved my thing but I need to display the empty terms also.


texts:
I am trying to create a slideshow that would be showing 3 instances of my custom contant type "Slideshow Image".
After spending hours without any success I've decided to seek help! I noticed that Views changed a lot when I updated all modules, and it seems as if Slideshow is not among the options for display under "Format" in the control panel of my view. I have Grid, HTML list, Jump menu, Table, Unformatted list but no slideshow. Now, I think I remember seeing "slideshow" as an option before "Views" changed! My questions are:

Have Views changed so that Slideshow is no longer an option for display? Am I going insane?
If it has, what is the new way of doing things?
If it hasn't, what could I be doing wrong?
There is a module called "Views Slideshow". It seems to not be fully ready for Drupal 7 yet. Do I need it? Is that my only option (as a Drupal & web programming newbie)?

Can anybody please help me clear this out?


texts: Product price not showing up in views without Disable SQL rewriting

texts:
I got a Commerce Product set up in Drupal 7 with a content-type Product Display that have a product reference to it. Users have read access to Product Display but not direct access to the Commerce Product.

I am now trying to set up a Pane in Views 3 that list Product Display nodes in a table. I want to include the Price in every row. I have added the referenced product in relationship and were about to add the price field from the product.

This view however does not display at all for normal users. I suspected that normal users don't have access to the Product entity, so turned on Disable SQL Rewriting and now Views displays the table as intended for normal users.

I am wondering if this is the right way to get the price to show up in Views? I can see that the Product Display node can actually display the price on its page without giving access to the Product to normal users, but cannot find how to access that display field within just the node in Views.


texts: Twig: Display media library reference user image at particular resolution with alt tag (on /user/1231 page)

texts:
On our user page (/user/12345) we want to change the profile image field to be a media library reference field instead.  I've created for the user object a new field called field_profile_image that is an entity reference/media library reference.
In my twig template for this user page I can display the full rendered user image in the default display mode with a bunch of extraneous information by using {{ content.field_profile_image }}
What I would like to do is display just the image at 136x156 (a media display mode I've set up), preferably with an alt tag.
I've tried various solutions with or without twig tweak, and am still having trouble showing just the referenced image with an alt tag.
Note that I see a lot of examples for twig tweak have something like
{% set media_uri = node.field_media|file_uri %}
{% if media_uri is not null %}
{{ media_uri|image_style('thumbnail') }}
{% endif %}
but node is null since this is not on a node, and replacing node.field_media with content.field_profile_image in the above script doesn't render anything at all.
How can I display a media library image in a particular display mode preferably with alt tag?


texts: Login form (or user registration) don't show $messages

texts:
This is a weird issue. I have a custom theme which prints the login form (or user registration):

$form = drupal_get_form("user_login");
$user_menu = drupal_render($form);

This works fine, and logs me in. However when I enter faulty data and submit no messages are shown. Upon dumping the $messages array I can see that each request actually generates two distinct logs. The first one is empty and the second is populated with the contents I require. If I F5 on the page, the messages show as expected. Obviously this won't work for end users. :)

Anyone encounter any issue like this before?

I do not have any third party login modules or actions/triggers set up...it's a fairly bare bones install. Very confused/frustrated.

EDIT | This sounds similar (drupal_get_messages always blank)

EDIT2 | I am using a sub-theme of the bootstrap theme if this makes any difference.

Alex


texts: Adding a vertical tab the the content type form page

texts:
How can i add a vertical tab to the content type manage form page?

I want to add a vertical tab that has a form like the ones it currently has.  For example: it has menu settings, display settings, etc.  I want to add a tab that ties a theme to a content type.  Can you someone help me out?

Thanks


texts: top items rendered as  and remain clickable (give page refresh)

texts:
I have a TB megamenu (8.x-1.x-dev) with a few top-level (parent) items that are not links, they should just trigger the submenu to drop down.
According to the documentation I could find, links marked as <nolink> or route:nolink will be rendered as <span> rather than <a> so styling can be retained, but they can't clicked, and submenus should still be toggled.
However, both <nolink> and route:nolink are still rendered as <a>, causing a page refresh when clicked.
I have tried adding the nolink definition as a special menu item under (A) admin/structure/menu/manage/main-menu, and in (B) the tb mega menu settings at admin/structure/tb-megamenu/main-menu, but nothing helps:

  When adding `nolink` to the Drupal menu link (A), it leaves the link empty, but you get the page refresh when you click it. Submenu does unfold.
  When adding `nolink` to the TB Megamenu link (B), it leaves the link empty, no page refresh as it now activates a css class that says `.nolink {pointer-events:none;}`, but button goes dead, and submenu does NOT unfold.

When on mobile, all menu items with children do unfold the submenu, don't trigger a page refresh; it's that behaviour I'd love to be able to have in desktop/laptop view too. (Even better if there is a switch "active link yes/no" or similar, so I can decide per button?)
Any help much appreciated :)


texts: How to add a button to a custom table that opens a form in a new tab and automatically fills out with data from that table

texts:
I have a custom module where I create a table from some data. In one of the columns I need to have a button that when clicked will open a new tab and show the user a form and a submit button and some of the form fields are pre-filled with data from the table (data from the same row).

I know how to add a button but I don't know how to pass the data to the form.

Also, for the button I'm using the following code and maybe this is already wrong:

$new_button = 'New form';

Note: the data is not in the drupal database. The table is made on the fly using REST.

Any help will be greatly appreciated. Thanks!


texts: How to do the live streaming of music channels on my site?

texts: I am about to work on internet radio site.How am gonna do the functionality live streaming of channels.Any help will be appreciated .


texts: Is there a function I can use or object I have access to in page.tpl.php in order to get the Administrative title of the current page or it's machine name?


texts: How do I display a field from a referenced user?

texts:
I have a content type A with a reference to a user and I would like to show a specific field from that user in nodes of that content type.

How can I achieve this?


texts: Is there a way to safely downgrade modules after installing a version that has a database update?

texts:
I have a site with a lot of modules running Drupal 7.  I just installed a bunch of module updates, ran update.php, and then started running some tests, upon which I noticed that one of the module updates broke an important function on my site.

After some more testing, I discovered which module update broke the function (an update from rc1 to rc2).  Reverting this module back to the previous version (rc1) restores the function on my site.  However, when I installed rc2, there was an update to the database for that module which was performed when I ran update.php.

I'm going to wait for rc3/a 1.0 release of this module to update again.  However, is it safe to simply re-install the old rc1 version over rc2?  Or could this cause major problems down the line and should I instead revert from a backup?

I'm not giving specific module names because I'd like to know what the general best practice (if any) is for "downgrading" modules.


texts: How to unset $page['#attached']['html_head_link'] from head?

texts:
Help me with this question please: how to unset html_head_link from pages in my Drupal 8.0.3 site.

I mean, delete this META:

<link rel="delete-form" href="/node/{id}/delete" />
<link rel="edit-form" href="/node/{id}/edit" />
<link rel="version-history" href="/node/{id}/revisions" />
<link rel="revision" href="/mypage" />

I try this in MYTHEME.theme file:

function MYTHEME_page_attachments_alter(array &$page) {
  foreach ($page['#attached']['html_head_link'] as $key => $value) {
    unset($page['#attached']['html_head_link'][$key]);
  }
}

But this do nothing...


texts: Adding different classes to menu item list

texts:
I'm trying to override the way that menu items are displayed. I have the following function :

 function newtheme_item_list($items = array(),$title=NULL,$type='ul',$attributes=NULL)
 {
 $positions = array("","second","third","forth");
if (!empty($items)) {
$output .= "<$type" . drupal_attributes($attributes) . '>';
foreach ($items as $item_key=>$item) {
  $attributes = array();
  $children = array();
  if (is_array($item)) {
    foreach ($item as $key => $value) {
      if ($key == 'data') {
        $data = $value;
      }
      elseif ($key == 'children') {
        $children = $value;
      }
      else {
        $attributes[$key] = $value;
      }
    }
  }
  else {
    $data = $item;
  }

  if (count($children) > 0) {
    $data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list
  }
  if ($item_key > 0)
  {
    $attributes['class'] = ' nav_separator '.$positions[$item_key].'-nav';
  }
  if($item_key == 0) {
    $attributes['class'] = 'first-nav';
  }
  elseif($item_key == count($items)-1){

    $attributes['class'] = ' last-nav';
  }

  $output .= '
'. $data .'
';
}
$output .= "</$type>";
}
$output .= '
';
return $output;

}

In the page.inc.php i have the line:

print theme('links', array('links' => menu_navigation_links('main-menu'),'attributes' => array('class'=> array('links', 'site-menu'))));

This it should add some different classes to my menu but instead i get this error:

Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in D:\EasyPHP-5.3.5.0\www\drupal\themes\newtheme\template.php on line 12 and defined in drupal_attributes() (line 2301 of D:\EasyPHP-5.3.5.0\www\drupal\includes\common.inc).


texts: How can I have the language-specific 'enabled' Boolean of menu items being respected?

texts:
I'm trying to translate the 'enabled' field of menu items in Drupal 8. So far I have written this code in MYMODULE.module file:

function MYMODULE_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) {
  if ($entity_type->id() == 'menu_link_content' && !empty($fields['enabled'])) {
    $fields['enabled']->setTranslatable(TRUE);
  }
  return $fields;
}

This works fine and I am able to set the enabled field differently for different languages. eg: for the same menu item, I can check the 'enabled' field for English, but uncheck the 'enabled' field for French.

But it does not work as expected. It hides the menu item for all languages. Should I use hook_preprocess() or hook_preprocess_menu() or some other hook for the menu item to show/hide based on 'enabled' field in different languages? Can someone give me some hints on this?


texts: What permissions affect fields attached to taxonomies that don't affect fields attached to content types?

texts:
On a D7 site, I created a Description field (using filtered text with ckeditor) and a Geolocation field using a Googlemap widget.

I attached them to a content type called Accommodation, and they behaved as I expected - ie, I got a rich text editor on Description, and a map on the Geolocation field, when logged in with any role that would allow me to edit a node of that content type.

I attached the same fields, with the same settings, to a Taxonomy, and found that I could only see the map and ckeditor if logged in as an administrator.

If I logged in with another role, the googlemap and rich text editor would not appear, although I was still able to create a taxonomy item, and they did appear on the same fields shown on a node create form  -  just not on the taxonomy item create form.

I have all taxonomy permissions turned on for authenticated users.


texts: Is there a function to get the system path for the current language?

texts:
If I'm using multiple languages on the site with path prefixing, is there a quick way to get a system path for the current language?

For example, if the current language is English, and I'm interested getting the English path for 'user/password', what function call (or small number of lines) will return 'en/user/password'?

The following doesn't seem to work; it returns nothing:

drupal_lookup_path('alias', 'user/password', $language->language);


texts:
I have a views page in which I can search by narrowing down to a category. It also has a pager. So you could get something like Category: X page: 2.

When I found the result I'm looking for I navigate to that result. But when I want to go back my category and page I was on are lost.

I've worked around this by using a history.pushState in which my URL changes to something like  ?f[0]=field_category:3&page=2.

This works perfectly fine, and I can navigate back and forth without too much hassle.

However:

The previous button and the first button in my pager don't work properly anymore!
The previous button goes to the previous page until it reaches page 2, if I'd like to go back to page 1 it navigates back to page 3, and when pressing previous on page 3 it goes back to 2 etc. etc.

The first button just navigates between the current and the previous page. 5 to 4 => 4 to 5 => 5 to 4 etc. etc.

What I'm doing in my javascript on an ajaxComplete is add all the variables I want in my url to an array. When I've collected them all I join them to a single string which I put into the pushState:

query_vars[query_vars.length] = 'page=' + (current_page); //for every variable
query_string = '?' + query_vars.join('&');
var stateObj = {};
window.history.pushState(stateObj, "New", href + query_string);

In short:

Why does my previous button won't go back to page 1(but instead goes to page 3)
And why does my first button jumps between the current and the previous page and vice
versa?

PS:

Opening the "previous" button's link in a new tab works fine!


texts: How to get the unrendered contents of a block

texts:
I have a template file in which I would like to restructure the output of a block item (the applicable block changes depending on the page you are on). Basically what I want to accomplish is to list the items that will be rendered in a region, pick out the one I want and then modify how it will be displayed. What would be the best way to accomplish this? Can I do this through the template file?

Thanks.


texts: How can i get groups to which user is group manager in og and profile2?

texts:
I am using profile 2 and Organic Groups module on my site . I just need to know what should I put in query to get the group ids to which user is manager. Using this query i am getting the group ids of groups to which user is member.

  $result = $query
    ->entityCondition('entity_type', 'og_membership')
    ->propertyCondition('entity_type', 'user')
    ->propertyCondition('etid', $account->uid)
    ->propertyCondition('state', OG_STATE_ACTIVE)
    ->execute();

what should i put instead of og_membership to get the ids of groups user is manager to.


texts: How to create a line graph of the total user points on a profile page?

texts:
I'd like to have a line graph of my users' total user points in time on their profile page. Users shouldn't be able to modify the graph: it should simply graph the user points from the day the user registered until today. I'd like to use the Charts module, but I don't know how I can provide the necessary data (date and daily total points).

Perhaps it's also handy to mention that the profile pages on my website have been overridden with "user_view" (see: How to create a profile page?) into a panels page.

How can I achieve this?

Edit: I tried to find a solution, using Field Collections as @Felix Eve suggested in his answer. I've successfully added a Field Collection to my users, but I'm still stuck at these points:

Save the userpoints at the end of the day as a field collection item for all users.
Graph the userpoints in a Chart.

Solving these problems, solves this problem aswell.


texts:
I have a block, and want to print it in the template. I use the following code:

 $block =  module_invoke('block', 'block_view', '6');
 print render($block["content"]);

It works, but in module_invoke() I use the ID of the block in the database, which is very bad. Is it possible to assign the string ID to the block and use it instead?

If it's impossible, how can I use strings instead of numbers?


texts:
I have a situation where I need to create a node that is of a custom content type outside of drupal.

Is there anything involved besides inserting an entry into the node table and data into the content type table?


texts: How to tell what is being loaded on a Rules Content is viewed event

texts:
Is there a way I can see what exactly is being executed on a Rules Event of 'Content is viewed', followed by an action of page redirect to an external URL? Specifically if the content is actually being viewed, and then redirected.

I tried Devel viewing the query log and I didn't find anything. I also tried Devel's Display redirection page, but upon visiting the node, it just timed out.

Using rules event 'Content is viewed', then redirecting, I am still able to get a log message that says I visited that node, so I believe it is loading the node, then redirecting.

This concerns me because when I test other methods of node redirects to external URLs, I don't get a log message saying that I visited that node.


texts: how do I create multiple modules that both add to the output of a node?

texts:
We have a content type called "sales_order" which contains order data for online sales.

I have created a custom module that adds a form to the node that allows a user to generate shipping quotes. I do this by creating this function which adds my form to the node:

function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {

if ($node->type=='sales_order' || $node->type=='sales_orders')  {
    switch ($op)
    {
        case 'view':

            $form .= drupal_get_form('mymodule_form',$node->nid);
            $node->content['form'] = array
            (
                '#value' => $form,
            );
        break;
    }
}

This works great, but, now I want to add an additional form for another shipping provider. So I created a new module doing the same thing but when I enable both, it only outputs the form for the first module and not both?

I think I am misunderstanding how this is supposed to work.

How should I get multiple custom modules to add content (a form) to a node?

PS I know I could easily integrate both providers into a single module but I would prefer to keep them separate for now.


texts: drupal issue with install profile and domain module?

texts:
I had generated the make file with the contrib module domain.
When we enable the domain module, we just want to append the following code to the settings.php file.

include_once DRUPAL_ROOT.'/profiles/my_profile/modules/contrib/domain/settings.inc';

When i try to install this profile, i get an error

  Fatal error: Undefined function domain_get_primary_table()

this happends because when we install a profile the settings.php file overwrites the include settings.inc. So when it try to install the domain module it gives the above error and stops installation.
Anyone gave idea that how can we install the profile along with the domain module without this issue.

Thanks,
A.John


texts: Change max length of link field link text

texts:
In order to modify the length of a file field description field I put the following line in settings.php:

$config['file.settings']['description']['length'] = 512;

Now I want to do the same for the link field. How can I change the max length of the link text (without patching the module)?

I think the problem is that FileWidget.php gets the length from the configuration

'#maxlength' => $config->get('description.length')

whereas it is hardcoded in LinkWidget.php:

'#maxlength' => 255


texts:
I am revamping a website which is uses Drupal Commerce. I want to actually mirror the website and work on it offline before bringing it back onto the server as the newer version.

Obviously while I am doing this there is likely to be orders made and new users registered.

How can I import these or somehow bring the revamped website upto date with all users and orders?

Can anyone see any other issues with doing this also?


texts: How to display a customized button on a single form only?

texts:
I have created a reset button by adding a customized module (Reset) for webform. But this button gets displayed all over the site. I just want to display this button on a single webform.

Below is my Reset module code:

<?php
/*
 *
 *  creating  hook_form_alter()
 *
 */
function custom_example_form_alter(&$form,&$form_state,$form_id) {
            $form['webform_client_form_34'] = array(
            '#weight' => 1001,
            '#markup' =>'<input class="form-button" type="reset" value="Reset"/>',
            );
            return $form;
}

How should the if condition look like that I should be adding to it ?


texts:
I am using IEF and all is well...until I try ad implement hook_form_alter() and when I access the form via IEF UI (as opposed to directly modifying the entity) none of the changes I make appear to take effect.

I see everything is posted to a ajax/system as well as pulled from when assembling the form...

Is it not possible to hide form elements from the IEF as I would when directly hooking?

Any ideas?

Each line item has a price field which I need to iterate and sum and the apply to the root node. Figured as this module was used in commerce this would be standard practice.


texts: How to update my module's dev branch on Drupal.org

texts:
I have a module on Drupal.org and I only have a dev branch.  This is how I added my dev branch by tagging with 7.x-1.x-dev:

git commit -m 'Creating module'
git push origin 7.x-1.x
git tag 7.x-1.x-dev
git push --tags

Now I made some more changes and would like to have my dev branch updated with the latest code. I delete the tag and recreate the tag:

git tag -d 7.x-1.x-dev
git push origin :7.x-1.x-dev
git commit -m 'Adding new feature'
git push origin 7.x-1.x
git tag 7.x-1.x-dev
git push --tags

I did this and I don't see my files get updated on Drupal.org. Am I doing something wrong?


texts: Prevent users of role from being flagged?

texts:
The Flag module is pretty robust, so maybe I am missing something. It has a lot of access features as to who can flag/unflag but I can't seem to find a way to prevent a user/role from being flagged.

Scenario: Creating a flag where all administrators posts should not be able to be flagged but "authenticated users" should be able to flag other content for other roles. All roles content should be flaggable except for administrators (or "premium users")

There doesn't seem to be a "if user is of role X, disable the ability to flag/unflag using FLAG NAME" permission or setting.


texts:
I'm trying to make a block display on a specific page and inside a node type; I got this code from drupal.org, but I keep getting this error.

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /home/content/45/6861545/html/includes/entity.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of /home/content/45/6861545/html/includes/entity.inc).

This is the code I used.

$match = FALSE;
$types = array('middle_content' => 1);
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid));
  $type = $node->type;
  if (isset($types[$type])) {
    $match = TRUE;
  }
}

if (substr($_SERVER["REQUEST_URI"], 0, 10) == '/test'){
  $match = TRUE;
}

if (substr($_SERVER["REQUEST_URI"], 0) == "/node/add/middle_content") {
  $match = TRUE;
}

return $match;


texts: How to create table view with progress bar?

texts: I want to create a tabular view with progress bar. The drupal-6 view consists of goals of activities I need to do. I have created a content type called Goal that is composed of activities/task. I want to list the goals in a tabular view and show a progress bar in one of the column that indicates how many task/activities under the goals have been completed. How can I do it?