texts: In using the rule "OG new content notification," (rules_og_new_content) how can I insert the group name in the outgoing email

texts:
In using the rule OG new content notification (admin/config/workflow/rules/reaction/manage/rules_og_new_content) for a site using Organic groups. However, I'd like add in the name (and URL) of the parent group. However, I'm not seeing these options in the tokens ("replacement values").

The Content Type in question has the field og_group_ref for which I'm trying to target.

What I've tried so far (update):

On a dev instance, as per Pierre's recommendation below, I've added the following 'fetch entity' to the rule.

But the email comes in blank, without title on the subject line


texts:
I have created a custom front page in my theme (page--front.html.twig) and put some custom content which is coming up as expected as long as I am not logged in. But when I log in as admin, I cannot browse the homepage anymore. Rather Drupal always takes me to eventcloud.dd:8083/user/1. Even if I manually modify the URL to eventcloud.dd:8083/ it gets redirected to the above URL, i.e. with user/1.

To double check I created an Authenticated User (without administrative rights) and logged in with this account. Same thing happens. Why the system navigates to another page and not staying on the homepage? How to fix this so that homepage only loads up homepage?

I initially created a page upcoming-events and set it up as my default homepage from admin/config/system/site-information. I removed that and presently there is no homepage defined separately.

Please advice.


texts: I am using getlocations fields to get the user to fill his location and now I want to display a facet based on the city which we get from the getlocations fields and also I want to display the name which we get from getlocations fields as a sub-facet for the corresponding city but I am unable to do it. Can you help me?


texts: currency field and currency switch with currency module

texts:
I installed the Currency module expecting to setup a currency field and a currency switch. Like switching the language, I'd like to switch the currency (of a field). The currency should switch depending on localization path or the set currency in a currency switch.

I have no idea how to set a field as a currency field and how to get a currency switch.

Is this possible with Currency? If yes, how?


texts:
How can I write data to file in themes folders? I am getting the following error. Directory permissions are drwxrwxr--.

  temporary://fileOFwrpn could not be moved/copied because the destination directory is not properly configured.


texts: could i overwrite the array value by the preprocess function?

texts: a module that have an array,which value are $links[0]['text']="hello" and $links[2]['text']="world". could i overwrite them value by the mytheme_preprocess_node function in template.php. if can., how do i do?


texts:
I just made a $form['table']. It shows enough rows (the count of the total rows in database) only it doesn't show the results. I tried using #value, #title, #markup but nothing works

Screenshot of result:

My code:

function push_notifications_stats_form($form, &$form_state) {
$form = array();
$id = $_GET['id'];

$query = db_query('SELECT * FROM push_notifications_messages WHERE msg_appID = :app_id', array(':app_id' => $id));
$qCount = db_query('SELECT * FROM push_notifications_messages WHERE msg_appID = :app_id', array(':app_id' => $id))->rowCount();

$form['table'] = array(
    '#theme' => 'table',
    '#header' => array(t('Message'), t('Device'), t('Date')),
    '#rows' => array(),
    );

foreach($query as $result) {
  for($i = 1; $i <= $qCount; $i++) {
    $form['table']["#rows"]["r$i"] = array(
        "'c1'" => array(
            '#type' => 'textfield',
            '#value' => t('hoi'),
          ),
        'c2' => array(
            '#type' => 'textfield',
            '#title' => t('device')
          ),
        'c3' => array(
            '#type' => 'textfield',
            '#title' => t('device'),
          ),
      );
  }
}

$form['id'] = array(
'#type' => 'item',
'#title' => 'Application ID',
'#description' => t('The application ID you are viewing: @appId', array('@appId' => $id)),
);

return $form;

}

When I check the $form with dsm it does show the results.. And also when I use my browsers element inspector it does show the values. Only it puts them inside the first  tag. while it should be between the  tags

<td #type="textfield" #value="hoi" #data="hoi"></td>


texts: How (and Where) to store downloadable commerce files outside the file system..?

texts:
I’m building a Drupal Commerce site and am selling downloadable mp3’s. It was recommend that the downloadable commerce files should be kept outside the sites file directory. I’ve tried setting this directory in the admin in 2 places, as separate attempts:

First i created a folder called commerce_files and set it one level up from the Drupal install

Then i tried referencing this folder in 2 places (as 2 separate attempts)

Configuration->Media->File System
Configuration->Product Variation Types->My MP3 Content type->File

Neither worked.

When searching the internet for this topic nothing much is coming up. Does anyone here have any insight or info on this topic? it would be appreciated, thanks

Or maybe i was misled and it is perfectly acceptable to store within the file system, using the Config->Media->Private Folder setting in the admin as i have been doing....?

FYI - have gotten almost no responses when posting the Drupal commerce.org,


texts: Show field conditionally + display each form part in div

texts:
I've followed the tutorial in order to create field conditionnaly, but the field is always shown.
This is possibly due to the way I'm calling my form ? And if I do as I did in my template, how can I have my input in bootstrap's column and keeping the conditional rules ?
This is my form builder:
  public function buildForm(array $form, FormStateInterface $form_state)
  {
    $form['#theme'] = 'contract_search';
    $classes_input = ['form-control'];

    $form['colour_select'] = [
      '#type' => 'radios',
      '#title' => $this->t('Pick a colour'),
      '#options' => [
        'blue' => $this->t('Blue'),
        'white' => $this->t('White'),
        'black' => $this->t('Black'),
        'other' => $this->t('Other'),
      ],
      '#attributes' => [
        //define static name and id so we can easier select it
        // 'id' => 'colour_select',
        'name' => 'colour_select',
      ],
    ];

    $form['custom_colour'] = [
      '#type' => 'textfield',
      '#size' => '60',
      '#placeholder' => 'Enter favourite colour',
      '#attributes' => [
        'id' => 'custom-colour',
      ],
      '#states' => [
        //show this textfield only if the radio 'other' is selected above
        'visible' => [
          //don't mistake :input for the type of field. You'll always use
          //:input here, no matter whether your source is a select, radio or checkbox element.
          ':input[name="field_select_colour"]' => ['value' => 'other'],
        ],
      ],
    ];

My controller method :
  public function contract_add() {

    $form_class = '\Drupal\contract_search\Form\ContractSearchForm';
    $form = \Drupal::formBuilder()->getForm($form_class);
    return [
      '#theme' => 'contract_add_page_theme',
      '#title' => 'Déposer une annonce',
      '#form' => $form,
    ];

  }

my module routing
contract_search.contract_add:
  path: '/contrat/ajout'
  defaults:
    _controller: 'Drupal\contract_search\Controller\ContractSearchController::contract_add'
    _title: Déposer une annonce
    _form: '\Drupal\contract_search\Form\ContractForm'
  requirements:
    _permission: 'access content'
  options:
    parameters:
      reference:
        type: string

and finally my twig template
<section id="add_contract">
  {{ form }}
</section>

This is what is generated :


texts: tb mega menu is not showing in bootrap theams in drupal7

texts:
I am new user of drupal 7.3. I am using bootstrap 3.0 theme in drupal 7.3.

I am using tb mega menu which is not showing. Black color box will be occurred in navigation block.

Please help me to solve this I want solution step by step. I want used in my project please help me.


texts:
I'd like to use Drush 10.3.6 to generate votes on my development server.
Based on these instructions for a previous Drush version (8.x), there is some kind of module/extension for this.
drush generate-votes

However, when I try it, it doesn't work for me. The error message I get is the following one.

Command "generate-votes" is not defined.

Has this feature been removed or deprecated? Is there any other way I can generate votes from the command line?


texts: How to apply a sort criteria to multiple displays without erase each individual criteria?

texts:
I have a view with multiple displays and I have some sort criteria applied to all the displays and one applied individually to each display. Now I have to add one more sort criteria to all displays. But if a I select to apply to all it just erases the individual one.
Is there a way to workaround it? Because it will be a burden to apply to each display individually again.
Ps.: I'm just an end-user, I don't have access to the site's code.


texts: How do I properly pass taxonomy term from panels to the context filter in views?

texts:
I have a Book Listing content type and a Series content type. Both of these have a Book Series taxonomy term applied to them. What I want to do is override the Series page with panels and embed a view that will list every book with a matching Book Series tag.

What I've tried is creating a content pane view with a contextual filter of "Content: Book Series", Argument input set to "From context", and Required Context set to "Book Series".
I've inserted the view and set the argument to the only one available: "Node being viewed".
I've tried everything I could think of including creating contexts and relationships in the panel, creating relationships in the view, etc. I'm at my wit's end here. At the moment I'm relying on a separate view page to show what I want, but it's making the site navigation a pain to deal with. What am I doing wrong here and where can I find a good explanation of contexts?


texts: Update schema.yml variable type: string to integer

texts:
I would like to update my module schema variable from string to integer.

mymodule.settings:
  type: config_object
  label: 'Module settings'
  mapping:
    identity:
      type: string -> integer
      label: 'Identity'

I've changed it in the schema.yml file and also I've created a hook update to update it:

function mymodule_update_8001() {
  $facility = (int) \Drupal::configFactory()->getEditable('mymodule.settings')->get('identity');
  \Drupal::configFactory()->getEditable('syslog.settings')->set('identity', $facility)->save();
}

But after the update the variable is still a string. I've been digging out and the problem is that the configuration schema cast the value as string because the cache of typed_config_definitions has the old definition.

Drupal\Core\Config;

  public function save($has_trusted_data = FALSE) {
    // Validate the configuration object name before saving.
    static::validateName($this->name);

    // If there is a schema for this configuration object, cast all values to
    // conform to the schema.
    if (!$has_trusted_data) {
      if ($this->typedConfigManager->hasConfigSchema($this->name)) {
        // Ensure that the schema wrapper has the latest data.
        $this->schemaWrapper = NULL;
        foreach ($this->data as $key => $value) {
          $this->data[$key] = $this->castValue($key, $value);
        }
      }
      else {
        foreach ($this->data as $key => $value) {
          $this->validateValue($key, $value);
        }
      }
    }
...
}

So:

Should I force the update with $has_trusted_data = TRUE ?
Should I reset the CID typed_config_definitions cache in the hook update? how?
Is there any easiest way to do all this?

Thanks!


texts: Ignore table if it exists on module install

texts:
In my module I am using hook_schema() to create an empty (custom) DB table when the module is installed. However, there are some use cases where the module would need to be installed when the table already exists. This gives the following error:

  Drupal\Core\Database\SchemaObjectExistsException: Table example_table already exists. in Drupal\Core\Database\Schema->createTable() (line 594 of [PATH]\core\lib\Drupal\Core\Database\Schema.php).

It looks like the module is still installed, but the error likely means that future install logic might not be executed.

Is it possible to perform the schema logic only if the table does not exist, or some other way to ignore the table if it exists?


texts: 500 Internal Server Error after logging in

texts:
I have a D7 site. I start getting a 500 internal server error. I get the default Chrome (my browser) error page, instead of the one from my server.

This error occurs only after I log in and have navigated through a page or two. The apache error log shows nothing except for the following message :

[Sun Jul 15 21:53:27 2012] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 0 to 8 : URL /php5-fcgi/index.php, referer: http://new.whack.co.in/admin/modules

I can browse through the whole site anonymously without encountering any problems. I can even access the site temporarily by clearing my browser's cache.

The site uses a combination of Varnish+Apache 2+APC+php-fpm+memcache.
I have a D6 site installed on the same server and I can navigate through it without encountering any problems.

This site was installed by using Drush Site Upgrade. Contents and settings were migrated from a the previously mentioned D6 site. The D6 site is stored on /var/www/drupal (Accesible from default domain) while the D7 site on /var/www/seven - (accessible from a subdomain).

What can be the possible cause of the problem and how can I fix it? Please do let me know if any other information is required.


texts: Views hook query alter, change the DatabaseCondition Object

texts:
I am trying to alter views filters with hook_views_query_alter like

function custom_views_query_alter(&$view, &$query) {
     foreach($query->where[1]['conditions'] as $idx => $condition) {
      dpr($condition);
     }
}

And below is the output I get from DPR function

Array
(
    [field] => node.status
    [value] => 1
    [operator] => =
)
Array
(
    [field] => node.type
    [value] => Array
        (
            [0] => pricing
        )

    [operator] => in
)
Array
(
    [field] => DatabaseCondition Object
        (
            [conditions:protected] => Array
                (
                    [#conjunction] => AND
                    [0] => Array
                        (
                            [field] => field_data_field_zip_range.field_zip_range_from
                            [value] => 65000
                            [operator] => <=
                        )

                    [1] => Array
                        (
                            [field] => field_data_field_zip_range.field_zip_range_to
                            [value] => 65000
                            [operator] => >=
                        )

                )

            [arguments:protected] => Array
                (
                )

            [changed:protected] => 1
            [queryPlaceholderIdentifier:protected] =>
        )

    [value] =>
    [operator] =>
)

So the first 2 filters are not a problem, you just edit the field and you set new values. Problem is the DatabaseCondition Object  with this conditions:protected part. I just don't have a clue how to change values there.

There was similar questions here How to change the query value using hook_views_query_alter?  but it was not solved. It only solves problems for first 2 filters and doesn't do anything for DatabaseCondition Object.


texts: Creating fielded entities in a module: how to ensure unique field names?

texts:
I created some entities with the Entity Construction Kit, exported them with Features and proceeded to build a module upon that.

I had been pretty much ignoring field names, then realised I'd used really generic names for my fielded entities. Oops.

What's the best way to ensure names are not going to crash into the namespace of something else [in future]?

Is it module_name_entity_name_field_fieldname?

And if so, is there any problem with really long field names (and presumably, therefore even longer column names in the tables)? Is there a limit?

EDIT: yes, there seems to be a 32 character limit for field names. So how can you be sure of a unique field name?


texts: Does [Cache blocks] in Performance means that blocks generated by Views are also cached?

texts:
I am working on an old Drupal 6 project.
My goal is to boost the performance of the website as much as I can.
Among other things I have done, I have already enabled cache

Configuration > Development > Performance

My question is, does [Cache blocks] in Performance means that blocks generated by Views are also cached or I have to enable caching inside Views?


texts:
I am new to drupal , I have installed SEARCH API . I have opened an account with open solr and following the process suggested in https://drupal.org/node/2137651
since I am not using apache solr  search I am going to search api setting (last para in help )
the setup was succesfful and I was able to connect to solr server and infact was able to delete the index , However I am geeting the error message in config->search api->server as" You are using an incompatible schema.xml configuration file. Please follow the instructions in the INSTALL.txt file for setting up Solr"
I am also not able to index , it gives error 400
I dont know where I went wrong in follwing document of https://drupal.org/node/2137651
.I also copied the schema.xml from (open solr ) to drupal/sites/all/modules/search_api_solr/solr-conf/4.x

Any help is highly appreciated
Regards
Carol


texts: D7: filter fields in content type based on selected taxonomy terms

texts:
I am wondering if it is possible to display certain fields to users when they fill in a content type, based upon which taxonomy term they have selected prior in that same content type.

So for example, I have one generic NEWS content type, but it included several sub news categories. Say, I have made a NEWS vocabulary with 3 taxonomies, named: press, book, lecture. All three demand different information, thus different fields. Now I don't want to expose all these fields, but only those fields that are related to the taxonomy term one selected when filling in the content type.

Any pointers if this can be done?


texts: Table Sorting on "Content Indexed" View type

texts:
I'm working on maintaining a site that has a view of type (Content Index). This is the only site I've worked on that has had this view type on it. I may have traced that view type down to Search API.

The issue is I have a table that I need to be able to have the fields be sortable.
Right now there is one field that is sortable, but when I go into the Format/table settings, that is the only field (with the exception of the Node ID) that has a checkbox for sortable.

To check to make sure there wasn't anything wonkey going on with the fields, I created a quick view of type content (so a basic view) and recreated it, and all the fields provided were sortable, not just this one.

Is there a reason that one field would be sortable and not the rest, and if so is there something special that needs to be done in order to get the Content Indexed views to have more fields be sortable?

EDIT: "Content Indexed" view type is generated by search API, not Views Aggregator Plus. The body of the question has been updated to reflect this.


texts: Can someone clarify how "taxonomy term ID from URL" works?

texts:
I recently set up a View block that displays node titles that share the taxonomy terms (Tag vocabulary) of the node on which the block is displayed. I was unsure how to do this myself, so I found a tutorial. Everyone works fine, but I don't understand why.

The key to setting up this block was to establish a contextual filter with "When the filter value is NOT available" set to provide the default value of Type: "Taxonomy term ID from URL." However, unless I'm mistaken, the View is clearly taking taxonomy terms from the content of the node rather than the URL. It seems to me, according to what I've selected, that the URL would be the source of the terms it's looking for.

Again, the block seems to be functioning exactly the way I want it to (by using the node's tags as contextual filter criteria), but I don't know why using "Taxonomy term ID from URL" makes it work this way. Again, I don't believe there is any information in the URL itself that the View is using.

Can someone help me understand how this is working?

Thank you.

EDIT: Sorry, to clarify, I also have the contextual filter set primarily to "Has taxonomy term ID." But I also don't know how this is pulling information correctly. How does it know to look for the ID under the current node's ID rather than the URL, where I would normally tell it to look for an argument?


texts: hook_init() is not working in my custom module

texts: In my custom Drupal 7 module I am using CUSTOM_MODULE_NAME_init() function. But it is not triggered while page execution. Any suggestions?


texts: how to theme select box drupal for css framework

texts:
I am making a theme using semantic ui framework in drupal. I want to apply semantic ui select box effect to my theme but i was not able to do this. Here is the link for semantic ui select box http://semantic-ui.com/collections/form.html.

They used this for markup select box.

      <input type="hidden" name="gender">

Gender

Male

Female

But the standard markup for select box is:

<select id="edit-date-month" name="date[month]" class="form-select">
<option value="1" selected="selected">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
</select>

How can i apply semantic ui select effect to my drupal theme.
Any help would be appreciated.


texts: In custom install profile How to delete the "Footer" menu that core provides by default?

texts:
I am writing custom Drupal 8 install profile to be used in our organization.

The core creates the "Footer" menu as default system menu listed in menu admin page.

I want to delete or disable this menu during installation execution.

I already found that I can make it manually delete able if I add system.menu.footer.yml with

locked: false

But how can I eliminate it in the first place, via install profile ?


texts: how do I open a custom module form in colorbox popup?

texts:
I am creating a form in custom module, and I need to show this form in a view. How do I show this form in a color-box popup?

I have created a custom block to render this form, but I don't understand how to show this form in a view page, inside a popup.


texts: Ideas for notification of map events occurring in some user defined area?

texts:
I'm in charge of a full stack D8 (customer requirement) based project. It's mostly a Leaflet's web mapping application. The Leaflet part itself is almost done and it looks beautiful, fast and powerful. I let you know the URL once it gets released to the public.

Ahead comes a sprint ... This is the basic requirement of this phase:

The map is made of several, user switched feature layers.
Some of these layers receives regular updates, for instance: parties in the neighborhood announced witin the last week, two weeks and a month.
The 'parties' entity is stored in several mapserver endpoints (typically a REST service throwing GeoJSON out). Each period (week, two weeks, month) have its own endpoint.
Users (not Drupal users, subscribers only) draw an area in the map and 'subscribe' to the events announced on that area. By 'announced' I mean: points occurring within the user selected area.
At some specific time, my application is going to check the interesting points in the user defined area to send that out to the subscriber.

I forecast lots of challenges here. This is what I came up with to this very moment:

Create a content type with at least an email field and geofield support to store the points of the location area drawn by the user and her email (sort of a 'subscription backend').
Compose a new view to expose these subscriptions in some serialized fashion.
Code a helper script (bash, php, python) that is going to consume this D8 view and get the updated data from the mapserver endpoint.
Using cron and possibly Message Stack (yeah, yeah, I know, still in dev for D8...) to deliver the message for the final recipient.

This is an example of the entire use case:

http://fires.globalforestwatch.org/map/

In the right toolbox, look for the exclamation sign icon. This is the alert function of that map. Draw a line, enter your email and bang!

There are lots of other requirements for this use case (mobile friendly html emails, screenshots of the map with the 'parties' points and previously drawn area overlaid and such), but for know I'm concerned only with the most basic functionality: to store subscribers, their location of interest and how to transform this in some useful data for their mailboxes.

So, what are your thoughts? Anybody out there already faced this task? Any tips?

I don't need code (nor rejects if you wish). Any insights on a elegant way to get things done right? Oh, the less 3rd party modules, the better. Core ones are ok.

EDIT: the new Courier module (D8 only) just came to my attention.  It looks like a good contender to Message Stack in the message delivery front.


texts: How to prevent article titles to become links

texts:
I am making a website in Drupal 8. I made a new content type 'Slide' and a view called 'Presentation' that shows all slides as a blog page. I enabled the pager and set it to 1 item per page. This results in a nice slide show. See screenshot ('presentatie' is Dutch for 'presentation'):

The slides are small articles, containing text content and an image. They are shown by the Presentation view as full content, but their titles are still shown as links to the full article (slide) content. I don't want this linking, because by going to the full article, you leave the presentation page with pager for navigating through the slides. See screenshot of result on site below:

I am pretty new to Drupal and I can not find where or how to switch this off. Could anyone tell me?


texts:
I want to modify my bread crumb ( remove one link from bread crumb and add one link to bread drumb).

I tried,

/**
 * Implements hook_system_breadcrumb_alter().
 */
function modulename_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &$breadcrumb, \Drupal\Core\Routing\RouteMatchInterface $route_match, array $context) {
// to get current path and alias
  $current_path = \Drupal::service('path.current')->getPath();
  $result = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);

// get current route name
  $route_name = \Drupal::service('current_route_match')->getRouteName();
// check route is an quickinfo content create in group
  if ($breadcrumb && $route_name == 'entity.group_content.group_node__quickinfo.create_form') {
// get bread crumb links
    $breadcrumb_links = $breadcrumb->getLinks();
// fetch titile of the current path
    $title = \Drupal::service('title_resolver')->getTitle(\Drupal::request(), $route_match->getRouteObject());
    if (!empty($title)) {
// change third link of a breadcrumb
     $breadcrumb_links['2'] = Link::createFromRoute(t('RZ-schnellinfo'), '<none>');
    }
//    set links again
   $breadcrumb->setLinks($breadcrumb_links);
  }
}

SetLinks() ==> work when only bread crumb links doesn't exist, i.e.. we can create new links by using addLinks(). Since we need to remove a link we can use this function .

Then I followed https://www.drupal.org/node/2026025  but I am getting below error.

  exception
  'Symfony\Component\DependencyInjection\Exception\LogicException' with
  message 'Service                                    [error]
  'xxxxx.breadcrumb_xxxx_create' for consumer 'breadcrumb' does not
  implement Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface.' in


texts: Possible timing issues when using setActiveConnection to an external database under normal Drupal 8 operation

texts:
I'm using Drupal 8.0.5. In my settings.php file I have defined an external database:

$databases['notificationsdb']['default'] = array (
  'database' => 'NotificationsDB',
  'username' => 'my_user_name',
  'password' => 'my_password',
  'prefix' => '',
  'host' => '127.0.0.1',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

I have then created a custom form where I need values from the NotificationsDB database to populate a form fields. In my custom form class in the __constructor I created an instance of my Notification Client class:

public function __construct() {
        $this->_notificationClient = new NotificationsClient();
}

In my NotificationsClient class I have the following code:

public function __construct() {
        // Set the active database to notificationsdb
        \Drupal\Core\Database\Database::setActiveConnection('notificationsdb');
        $this->_db = \Drupal\Core\Database\Database::getConnection();
    }
public function __destruct() {
        // Set the active database back to the default
        \Drupal\Core\Database\Database::setActiveConnection('default');
        // https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Database.php/function/Database%3A%3AsetActiveConnection/8
}

When I go to view my form I get the following error:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'notificationsdb.shortcut_set_users' doesn't exist: SELECT ssu.set_name AS set_name FROM {shortcut_set_users} ssu WHERE (ssu.uid = :db_condition_placeholder_0); Array ( [:db_condition_placeholder_0] => 1 ) in Drupal\shortcut\ShortcutSetStorage->getAssignedToUser() (line 103 of core/modules/shortcut/src/ShortcutSetStorage.php).

From what I can tell the Shortcuts module is trying to run some queries against the NotificationsDB. I'm guessing this is a timing issue. I'm also concerned with how Drupal handles multiple database connections.


texts:
I'm building an Android app that communicates with Drupal Services 3 through Rest Server module.
On Drupal side, I'm using Facebook oAuth module for authentication.
so I want to let the app users login through their facebook account and issue authenticated rest requests to Drupal.

How is that possible, and is there any detailed guides?
Thanks in advance


texts: Is it possible to fully set up and enable Google CSE module before a website is launched? Or would I have to wait until it's launched and submitted to Google's search engine?


texts:
I'm running Drupal 7 from 2011-01-05 and I'm trying to uninstall Views Slideshow: Cycle (7.x-3.0 alpha1) and Views Slideshow(7.x-3.0-alpha1). I disabled them in the modules list then go to the uninstall list and uninstall them there but they still show up in the modules list and I can't re-install it because it says the modules are already installed.

I've tried clearing the cache.

Any ideas?


texts: Dealing with absolute paths while on localhost

texts:
I have a long-term path problem while developing modules.

For instance I have the following project path http://localhost:8888/mylocalproject, which (on the production server) would be http://www.project.com.

Now each time I use global $base_url or other absolute paths it only returns me the http://localhost:8888/ not http://localhost:8888/mylocalproject. For instance if I want to handcraft a logout link will give me http://localhost:8888/user/logout which is wrong, since mylocalproject is excluded.

I have all the time to hack solutions like this

global $base_url;
$needle = "localhost";
if (strpos($_SERVER['REQUEST_URI'], $needle)) {
  path = $base_url."/mylocalproject";
}
else {
  path = $base_url;
}

Is there a Drupal standard solution for that?


texts:
I've been trying to fix an issue with moving my drupal installation.

Some first information:

I am using the Open Social module;
I used a localhost a DNS to connect my Xampp to the same subdomain as I now on my FTP, so the links are identical.
I currently have turned off CSS aggregation to be able to see anything, otherwise the CSS is completely broken;

It seems like my theme css and image links have been broken due to moving my Drupal installation.

The only error I seem to get is "Failed to load resource: the server responded with a status of 500 (Internal Server Error)" into the console.

How I moved my Drupal installation:

back-upped the database through phpmyadmin
copied the insides of my xampp's  "htdocs" folder into a back-up folder
imported my database sql dump into the new database
uploaded the files from the back-up folder into my FTP
adjusted the settings.php file to communicate with the database.

I'm getting stuck in options as i don't know what is causing this.


texts:
I tried using CCK Migrate and this happens and field fails to get migrated, can someone let me know how to read this kind of error:

Requesting rollback of field "field_evt_mat_download" due to failure to convert record:

array ( 'entity_id' => '4715', 'revision_id' => '4742', 'field_evt_mat_download_fid' => '9109', 'field_evt_mat_download_data' => 'a:1:{s:11:"description";s:32:"Presentation (Open as Read Only)";}', 'delta' => '8', 'entity_type' => 'node', 'language' => 'und', 'bundle' => 'event', 'field_evt_mat_download_description' => 'Presentation (Open as Read Only)', 'field_evt_mat_download_display' => '1', )

Cause:

exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://local marketing/event/member-appreciation-october/2012/' for key 'uri'' in D:\xampp\htdocs\aadev\dev7\includes\database\database.inc:2171 Stack trace: #0 D:\xampp\htdocs\aadev\dev7\includes\database\database.inc(2171): PDOStatement->execute(Array) #1


texts: Make interface strings configurable per language, identified by machine name

texts:
We are building a complex page layout where some labels should be not only translatable, but configurable per language, including English. The display logic is already custom code, so we are quite free for how these labels are stored.

So far we have considered these options:

Harcode the English version, then call t().
Create variables for the English version, then call t(). (*)
Create variables for the labels, and mark them as translatable. (*) This requires a dedicated admin form where the labels can be configured in any language.

(*) These two options require a dedicated admin form where the labels can be configured either in English or in all languages. It can be useful to register the variables with variable module.
Of course when I say "variable" I mean those you manage with variable_set() / variable_get().

The question: Is there any alternative to the variable system where such configurable strings can be stored? Ideally something that already gives us an edit UI out of the box, without having to create custom forms..


texts: How can I rearrange taxonomy weights for terms with two-deep hierarchies?

texts:
I have a taxonomy vocabulary on my site of user ages.

It looks like this:

However, I want to change the weight so that 20s is -19, Late Teens is -18, Early 20s is -17, etc.  In other words, I want to change the weight so that when I sort by weight in Views, the terms appear in exactly the same order as shown on the screen above.

However, when I manually adjust the weights to -19, -18, -17, etc., upon saving the list of terms the weights are reverted to those listed above.

I tried individually dragging and dropping each term to change the order, but again when I saved the list, the weights had returned to this pattern:

Parent A 0
A Child A 0
A Child B 1
A Child C 2
A Child D 3
Parent B 1
B Child A 0
B Child B 1
B Child C 2
Parent C 2
Parent D 3

etc.

However, when sorting by weight in Views, this then gives a list like:

Parent A
A Child A
B Child A
C Child A
A Child B
Parent B
B Child B
C Child B
A Child C
B Child C
Parent C
C Child C

which looks terrible and makes no sense.

How can I manually control the weights and override whatever processing Drupal is applying to them?


texts: Path (alias) does not work after migration, nor Content view

texts:
I'm using the migrate (7.x-2.x-dev) module to import a node(s) from static HTMLs to Drupal 7, and I want to set the path the same as the original directory/filename.  I have defined in my migration class as follows,

$this->addFieldMapping('path', 'filename');
$this->addFieldMapping('pathauto')->defaultValue(0);

and it seems to be working - when I open the imported node in the edit mode, I see the correct path in the path field, and the Generate automatic URL alias checkbox is unchecked.

However, the path is not working.  Say, when the path is set to be info/legacy.html, and the node is 21,

http://localhost/node/21

is fine, whereas

http://localhost/info/legacy.html

returns 404 (Page not found).

In fact, the node is not listed in the Content page /admin/content either.  I found the node number (21 in this case) by browsing directly the SQL database (the entry of the node in the database looks no different from other nodes).

Everything else looks fine, I mean, all the fields related to the node are imported as I intend.  But the above-mentioned 2 points are weird...

Why is it so, and how can I achieve the above?  Any idea?


texts: How to control the order in which the markup for fields appears in the outputted html source for content?

texts:
Is it possible to control (as in change) the order in which the fields appear in the html markup?

On admin page for a content type admin/structure/types/manage/<content type>/fields and in the Manage Fields tab, the fields can be dragged and re-ordered in the list.

However, looking at the outputted html source, the order does not change according to the order in this list. Is it supposed to? (I'd like to think it does).

I also looked at field_weight to control the order of the output but it unclear in what the author(s) of this module mean by 'weight'. Trying this module didn't appear to change the order in the resultant html source.


texts: How do I make the output of field X look like Y?

texts: I have a field of type X, and it's output is not quite the way I want to it to be. I would like it to look like Y instead. How can I do that?


texts: How to speed up performance of taxonomy hierarchical select drupal

texts:
I have a taxonomy that have 35(States) -> 650(Districts) -> 6500(Blocks) -> 650000(Villages) taxonomy terms using hierarchical select  module

when i filter it on my content type form then it's performance is very slow. so, i want to know that how to increase it's performance when filtering.

i have installed taxonomy manager module but we can't use it as CCK Field of Taxonomy Term.


texts: How to embed all comments and comment form to other website

texts:
I have two sites.one is Drupal site (example1.com). It has a lot of comments. I want to embed all these comments and comment form to other site (example2.com)[non-Drupal site].

Is it possible?


texts: How to escape strings before insert query?

texts:
I've used mysql_real_escape_string() to make strings safe before using Drupal.

Must I escape string before inserting it to database? If the answer is yes, then how must I do it?

I use something like this to insert into database:

\Drupal\Core\Database\Database::setActiveConnection('mydb');
$connection = \Drupal\Core\Database\Database::getConnection();
db_insert($table_name)->fields(array(
'myfield1' => 'My String',
))->execute();
\Drupal\Core\Database\Database::setActiveConnection();


texts: Remove and uninstall module in a single patch

texts:
One of the modules I maintain contains a sub-module. The sub-module doesn't do much; just provides views integration for the main module, i.e. only have implementation of hook_views_data. I would like to move this implementation to the main module.

If it was D7, I would have followed the steps below:

Remove the module files.
Write an update hook in the main module, to remove the entry from the system table.
In the same update hook, would delete the variables (if present).

For D8, I have written an update hook for the same in the module (Reference : #2781805 : Social stats field are not available in views):

/**
 * Implements hook_update_N().
 *
 * Removes entry of social_stats_views module.
 */
function social_stats_update_8001(&$sandbox) {
  // Read the configuration.
  $module_data = \Drupal::config('core.extension')->get('module');

  // Unset the modules you do not need.
  unset($module_data['social_stats_views']);

  // Write the configuration.
  \Drupal::configFactory()->getEditable('core.extension')->set('module', $module_data)->save();
}

I did not add anything else (like removing config, etc.), as the module only implemented a single hook.

I still see the following error after executing the update hook:

  User warning: The following module is missing from the file system: social_stats_views in drupal_get_filename() (line 236 of core/includes/bootstrap.inc).

Is there a bullet-proof way to remove the module?


texts: Is it safe to remove database tables of removed modules?

texts: I have disabled the 'mollom' module a long time ago but the tables ('mollom' and 'mollom_form') still exit in database and it takes time to repair them when I try to optimize the database. So I am wondering whether it is safe to remove these tables altogether?


texts: Collapsing some fields in add content page

texts:
I want to use the drupal Collapse style for some fields.For example: while writing a story in my drupal 7 site, on the content publishing form user will has an option like "I want to sell this story"
Now, if the user click on it then some filed's will show-up like [Story Price] [Story License] [Topic Summary], so that they can provide all those necessary information's to sell the story. Either, if the user don't want to sell the story, they need not face those fields instead of "I want to sell this story" link! Any idea? Thanks


texts:
I have the following taxonomies:

Countries
Cities

When I create a new node Im allowing to enter "Cities" as a field of that node. Given that I have a "mapping" in place, how can I automatically assign the "Country" to that node as well (the user doesn`t have to do it, it happens in the background)?

Example:
I "tag" a node with "New York" - and that node is atomatically tagged with "United States" behind the scenes. When listing "United States" in a view, the node tagged "New York" would appear amond all other nodes tagged with US cities.

Also, where would the mapping of "New York -> United States" be defined?

Thanks for your help!


texts: How hide from menu content type Basic Page and Landing page

texts:
In Drupal 8,  I tried to remove default Basic page and Landing page content types, but it have content related to them. So, my quick fix will to only hide those one from some user. I tried with permissions but it didn't work .

/admin/people/permissions

Updated: Same issue

But users with role Content Publisher and/or Content Administrator still see those CTs in /node/add

There is any other way to hide those ones?

Thanks

Edit:
This option was the issue Create any content on assigned domains


texts:
I'm quite new to drupal ad I've some problem with parsing a query throught the API:

    SELECT t.pg,p.classe, sum(t.punti) AS punti, sum(t.vinte) AS vinte, sum(t.perse) AS perse, (sum(t.vinte)+sum(t.perse)) AS giocate
    FROM(
        SELECT sid, team_member_a_1 AS pg, punti_team_a AS punti, 1 AS vinte, 0 AS perse
        FROM `webform_views_unusual_arena__risultati_6` AS t1
        WHERE tipologia_risultato = 0
            AND vincente = 0
        UNION
        SELECT sid, team_member_a_2 AS pg, punti_team_a AS punti, 1 AS vinte, 0 AS perse
        FROM `webform_views_unusual_arena__risultati_6` AS t1
        WHERE tipologia_risultato = 0
            AND vincente = 0
    ) AS t
    JOIN webform_views_i_miei_pg_1 AS p ON t.pg = p.nome_pg
    GROUP BY pg

But I can't find any documentation about a subquery or how to add field like "1 AS vinte"

EDIT
Thank's to Tenken this is the code I used.

$subquery_1 = db_select('webform_views_unusual_arena__risultati_6', 't')
    ->condition('t.tipologia_risultato', 0, '=')
    ->condition('t.vincente', 0,'=')
    ->fields('t', array('sid'));
$subquery_1->addExpression('team_member_a_1', 'pg');
$subquery_1->addExpression('punti_team_a', 'punti');
$subquery_1->addExpression(1, 'vinte');
$subquery_1->addExpression(0, 'perse');
$subquery_2 = db_select('webform_views_unusual_arena__risultati_6', 't')
    ->condition('t.tipologia_risultato', 0, '=')
    ->condition('t.vincente', 0,'=')
    ->fields('t', array('sid'));
$subquery_2->addExpression('team_member_a_2', 'pg');
$subquery_2->addExpression('punti_team_a', 'punti');
$subquery_2->addExpression(1, 'vinte');
$subquery_2->addExpression(0, 'perse');
$query = $subquery_1->union($subquery_2);

$query->addExpression('sum(vinte)', 'vinte');
$query->addExpression('sum(perse)', 'perse');
$query->addExpression('sum(punti)', 'punti');
$query->groupBy('pg');
$query->orderBy('punti', 'DESC');

Hope it will help someone else


texts: Commerce Auction same product many auctions

texts:
I'm working on an auction website using Drupal Commerce Auction module. The requirement is to be able to create several auctions for the same product so that you don't have to create the product again and again.

Is that possible? It seems that the price added to the cart is the product's price. This might be an issue as different auctions for the same product would have different highest bids.

Any thoughts appreciated.


texts:
I'm working on a Drupal 7 Commerce site for a nonprofit and they are interested in generating year-end financial statements for their donors. With https://www.drupal.org/project/views_aggregator, I've been able to create a View which renders the desired output calculating the total donations for the year.

The user profile contains a field which allows donors to request a paper receipt to be mailed at year's end. Using https://www.drupal.org/project/views_pdf I can generate a .pdf.

What I'm lacking is a way to generate all of the needed paper files without visiting and printing pages one at a time. https://www.drupal.org/project/views_pdf/issues/1415380#comment-5701968 seems to address this (almost) but I'm yet to get this approach to function properly.

I'm surprised there is not a Commerce-centric module for this. If I've missed it, please let me know. Or, is there a tutorial explaining to save a file to the server based on a View's output? And what is the best way to trigger this? Seemingly Rules could be used to update a receipt every time a Commerce order is completed, but I'd prefer that the accounting department is able to hit a "Generate receipts" button to trigger this which would result in either files being saved to the server or a print job being created.

Thank you


texts: Has anyone implemented a tablesort with ajax?

texts: I would like to sort on a column with a round trip but no page reload. The table is very large and has to be paged in, which I am doing manually with an ajax select element. I know TableSort is available to extend the query but I've only seen examples that reload the page.


texts:
Im looking for a way to store the TOTAL number of nodes published on my drupal 6 web site at a particular month of the year so I can generate some curve from it :

timestamp | total node nb type x
2013/01   | 96
2013/02   | 100 (I mean 96+4, cumulative)
2013/03   | 120
[...]

the need seems simple to me, but I cant find any statistics module that cares about this. also the need is really simple compared to the features these modules offer.
I could write some piece of code about this using CRON and some requests to write such a table. maybe something with views count + cron.

but it certainly already exists somewhere as a module ?

thanks for any pointers/recipes.

jerome


texts:
What permissions do commerce configuration page (path: admin/commerce/config) need to view as a position in menu? Asking, because I added link to this page in my custom menu and user with access administration pages permission don't see it. But... he can enter this page and see all it's content. Same thing with admin/commerce path.

I was clearing all caches too. Nothing helped.


texts:
I usually update Core with Drush, because it's so easy and wonderful, but I have a custom htaccess and it always overwrites it, forcing me to rely on a checklist where I have to go and put my custom one back in. Is there a way I can either tell Drush not to overwrite it when updating or automatically put the custom one back in with a bash script or something? Or should I use a module to do these redirects instead? They are all like this and are a legacy from when our main company website hosted some custom apps:

RedirectMatch 301 ^/blah/ blah blah.cgi http://anotherwebsite.com/cgi-bin/blah.cgi


texts:
I have a content type with a "Date Repeat" field. I also have a view displaying events on a calendar.

What I need is to have some exposed filters to show only the events that happen between 2 and 6 pm (random example), any day of the week. The exposed date field only allow me to show content between 2015/12/1 12:00 to 2015/12/3 17:00 (random example).

This means it will show any content between that whole interval and I can't figure it out how to show content between 2 and 6, every day.

Any ideas on how I could achieve this? Thanks.


texts: Create new content of a different type within the article edit screen?

texts: My editors are asking to be able to create content of different types (albums, songs) from the same screen they use to edit articles. Are there any modules that support this type of functionality?


texts: Show custom content in Main Page Summary

texts:
I have a site using Ubercart that shows product summaries on the main page (I believe these are called teasers).  Each product has a voting widget provided by Vote Up/Down on its actual node/page.  I've copied page.tpl.php to page-front.tpl.php because I want to add a small block or box that shows the number of upvotes on the main page (but not actually allow voting here) and finally sort these teasers by popularity (number of votes).

I can see that print $content is outputting this page's content but I am not sure where this is being generated so I can either hook into it or modify directly.  I've coded themes and plugins in Wordpress but I don't know Drupal well enough yet.

Thanks in advance.


texts:
How can I unset a view field based on value of some other field in the same view ?
I cant use views php module ?
Is there any other option for it?


texts:
I decided to ask about this issue, because I found this problem is a common problem for many Drupal designers.

It seems to be a common problem for many drupal designers to face with the Server Error 500 after moving their site to the production server.

There are mainly two lines in the default .htaccess, which are:

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

So, for some hosts these lines should be removed.

What is your solution, after removing these lines from the .htaccess file? How should the directory listing be prevented?


texts: I have taxonomy in Json file. I need import this file into Drupal into exist vocabulary.how can I import data from Json file to exist vocabulary?


texts:
I would like to had a field link in a custom block. Here is my code to do that :

public function blockForm($form, FormStateInterface $form_state)
{

$form['key_1'] = [
    '#title' => $this->t('Key 1 label'),
    '#type' => 'textfield',
    '#default_value' => '',
    '#required' => false,
];

$form['key_2'] = [
    '#title' => $this->t('key 2 link'),
    '#type' => 'link',
];

return $form;

}
Now, when I go in admin/structure/block/manage/myblock, I can see my key 1 field. The key 2 is not render. If I change the type for any other (textfield, textarea, file_managed) my field is properly render. The default link module is enabled.

Is the link field type only usable in node form ? I can understand why.


texts:
I am using the latest version of drupal and trying to assign my custom created template to a view. I have created a view with machine name designers and followed this article to create custom template for a view. I place the view files inside core > profiles > demo_umami > themes > umami > templates > views folder.

Here is the code of the file views-view-fields--designers--page.html.twig

{#
/**
 * @file
 * Default view template to display all the fields in a row.
 *
 * Available variables:
 * - view: The view in use.
 * - fields: A list of fields, each one contains:
 *   - content: The output of the field.
 *   - raw: The raw data for the field, if it exists. This is NOT output safe.
 *   - class: The safe class ID to use.
 *   - handler: The Views field handler controlling this field.
 *   - inline: Whether or not the field should be inline.
 *   - wrapper_element: An HTML element for a wrapper.
 *   - wrapper_attributes: List of attributes for wrapper element.
 *   - separator: An optional separator that may appear before a field.
 *   - label: The field's label text.
 *   - label_element: An HTML element for a label wrapper.
 *   - label_attributes: List of attributes for label wrapper.
 *   - label_suffix: Colon after the label.
 *   - element_type: An HTML element for the field content.
 *   - element_attributes: List of attributes for HTML element for field content.
 *   - has_label_colon: A boolean indicating whether to display a colon after
 *     the label.
 *   - element_type: An HTML element for the field content.
 *   - element_attributes: List of attributes for HTML element for field content.
 * - row: The raw result from the query, with all data it fetched.
 *
 * @see template_preprocess_views_view_fields()
 *
 * @ingroup themeable
 */
#}

 Coming in the template

{% for field in fields -%}
  {{ field.separator }}
  {%- if field.wrapper_element -%}
    <{{ field.wrapper_element }}{{ field.wrapper_attributes }}>
  {%- endif %}
  {%- if field.label -%}
    {%- if field.label_element -%}
      <{{ field.label_element }}{{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</{{ field.label_element }}>
    {%- else -%}
      {{ field.label }}{{ field.label_suffix }}
    {%- endif %}
  {%- endif %}
  {%- if field.element_type -%}
    <{{ field.element_type }}{{ field.element_attributes }}>{{ field.content }}</{{ field.element_type }}>
  {%- else -%}
    {{ field.content }}
  {%- endif %}
  {%- if field.wrapper_element -%}
    </{{ field.wrapper_element }}>
  {%- endif %}
{%- endfor %}

Here is the content of views-view--designers--page-1.html.twig

{#
/**
 * @file
 * Default theme implementation to display a view of unformatted rows.
 *
 * Available variables:
 * - title: The title of this group of rows. May be empty.
 * - rows: A list of the view's row items.
 *   - attributes: The row's HTML attributes.
 *   - content: The row's content.
 * - view: The view object.
 * - default_row_class: A flag indicating whether default classes should be
 *   used on rows.
 *
 * @see template_preprocess_views_view_unformatted()
 *
 * @ingroup themeable
 */
#}

 Coming in the Template

{% if title %}

{{ title }}

{% endif %}
{% for row in rows %}
  {%
    set row_classes = [
      default_row_class ? 'views-row',
    ]
  %}

    {{- row.content -}}

{% endfor %}

When i load the page in browser i.e http://localhost/drupal/designers i am not getting the text i added in the template files.

Can anyone help me how i can show the html content which i added in the view files on the page http://localhost/drupal/designers.

I have spent 3 days and still not able to show the content on the page.

Thanks in advance.


texts: Is it possible to export arbitrary configurations?

texts:
I'm trying to create feature modules for as much as possible, such as

my backup schedule (for the Backup & Migrate module)
my shortcut sets
etc. etc.

and I'm surprised how much can't be exported with Features.  Is there some way to do this?  Either with an alternative module, or with something that extends Features, or by hand-coding the feature module, or by dumping just a specific table from the database???


texts: Drupal Commerce products sales limited by date

texts:
I'm building a foodhub site using Commerce. A foodhub works by having a collection day every week, so sales of products need to be attached to one of the collection days, such that what the consumer bought will be available on the day they selected (typically the next upcoming day). At a certain time, e.g. 24 hours before, sales for the next collection day should be disabled.

I am wondering how I can approach this using Commerce, or a with a Commerce extension.

I'm thinking one approach would be to create a "collection day" content type that would show all the products that have been purchased and added to that day. A number of collection day nodes could be created defining upcoming days. A field on a product would show which collection day it will be added to.  This would show the next upcoming day but can be changed (I need to figure this part out).

Is this a good approach, or is there a better way to tackle this problem?


texts: hook_menu URL giving 404 error on running site randomly

texts:
I have a hook_menu URL exposed as a URL and I am also calling the same callback function separately in code
The URL returns 404 at error at sometimes and starts working fine after a cache clear.
What could be the possible issue ?
hook_menu Implementation

  $items['test_link/get-response'] = array(
    'title' => t('Get Response'),
    'page callback' => 'get_response',
    'page arguments' => null,
    'access callback'   => true, // available to all
    'type' => MENU_CALLBACK,
  ); // end

function get_response($funParams=array(),$res='json'){
  $allParams = drupal_get_query_parameters($_GET);
  if(isset($funParams['pincode']))
  $allParams=$funParams;

  $result = array();
  $result["status"] = TRUE;

  // Processing on allParams and builds the response array
  return displayJSONResponse($result,$res);
}

function displayJSONResponse($response,$res='json'){
    if($res=='nojson')
        return $response;
    $res = '';
    if(defined('JSON_PRETTY_PRINT'))
    $res = json_encode($response, JSON_PRETTY_PRINT);
    else
    $res = json_encode($response);
    $json = str_replace('\\/', '/', $res);
    echo $json;
    exit;
}


texts: setting comments unpublished by default for a content type?

texts:
I want to open the comments for a content type by should be unpublished by default. Currently the comments are published by default.

Is there any way to accomplish this task. There is no option in the comments settings of the


texts: Custom Entity's Custom Fields doesn't show in when trying to Add Field in Views

texts:
I've created a custom entity and allowed administrators to add custom fields to this entity using the "Manage Fields" Form; however, the custom fields I add to the entity does not appear in the list that pops up when trying to "Add Fields" in a view.

How does one go about making custom fields appear in the Views?


texts: How to inject text into the beginning of a textfield?

texts:
I have a multilingual site with 3 languages where only 1 field (Description) is really multilingual, everything else is a translated interface and strings.

For the Description field, it has been my aim to replicate the functionality of Wordpress's "qTranslate" plugin so that the UI looks something like this:

I have almost managed to achieve this using Fieldgroup module, 3 description fields, and Language Sections module (because I found no better way to assign each field to its language).

So far so good. But at the top of each field I have to put in default texts (=fr  =en= =el=) so that Language Sections module knows which field is which language and displays the correct text depending on which is the current language.  If the end-users delete those =en= and =fr= tags, then the whole thing falls apart.

So I need a module that will inject those =fr= and =en= tags at the beginning of each textfield's entered text, in a way that's completely transparent to the user. Is there such a module?  Can Rules achieve a functionality like this?

Alternatively, if there is no such module, how would one go about creating one? Which function or which hook to use?

UPDATE
I made this module called language_markers based on the answer given by Beebee ,but it didn't work. Can you pleasetellmewhat I'mdoing wrong? :

<?php

function language_markers_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'property_for_sale_node_form' || $form_id == 'property_to_rent_node_form') {
    $form['#submit'][] = 'language_markers_submit_handler_function';
  }
}

function language_markers_submit_handler_function($form, &$form_state) {
  foreach($form_state['values'] as $field_name => $value) {
    switch($field_name) {
      case 'field_description_fr':
        $value = '=fr= '.$value;
        break;
      case 'field_description_nl':
        $value = '=nl= '.$value;
        break;
      case 'field_description_en':
        $value = '=en= '.$value;
        break;
    }
  }
}

UPDATE 2:
I have managed to get this to work with Rules module:

Event: After updating existing content of type Property for Sale

Condition: none

Action: Set a data value Parameter: Data: [node:field-description-en..., Value: =en= [node:field-description-en:value]

It works,but when the end-user comes back to edit the node, he sees "=en=" in front of his text. That's a BAD User-Experience.
This is a work-around, not a solution. I still need a solution.


texts:
I have installed the video module of the Drupal 7 distribution. I have added the "video" field to my content type. When I upload the mp4 format of the video, I get the following message:

  No video with support format and MIME type found.

What should I do?


texts: My drupal 8 watchdog entry running very vastly. I want to stop the watchdog entry for few times immediate basis and resolve the issues. Please suggest.


texts: Which cache have to clear to update new hooks?

texts:
I added a new hook inside a module (hook_cart_commerce_pricecomponent_type_info_alter), which cache have to clear to only update that new hook? I mean i do not want to clear all caches.

Administration menu?
Class registry?
Menu?
Page and else?
Theme registry?
Token registry?
Update data?


texts:
I have 2 sites locally (in MAMP) both in their own folders. I need both sites to be in the web root which I can change in the MAMP settings each time Im working on a different site.

However now I need to be able to look at both sites 'head to head'. Is there any way (im thinking with the htacess file) to make both sites work at the same time?


texts: Add background to a div based on a Node's Image Field

texts:
I had a request approach me and am blanking on a smooth way to implement this. We have on content type that on occasion will have a background image in a a div. The image will be a washed out background image behind content. The content authors want to add this page by page using an Image Field.

How would you implement this?

I'm assuming I can do this through our custom theme -- perhaps a theme_preprocess_page() or theme_process_page()?


texts:
I am going to replace the front page of a Drupal 6 site with a new index.php. How can I rename the Drupal 6 index.php (say, to drupal.php) and keep the Drupal site functions working? For example, I'd like to have all the URL aliases work as before.

Is changing:

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

to:

RewriteRule ^(.*)$ drupal.php?q=$1 [L,QSA]

in .htaccess all what I need?

I need Drupal to co-exist with another site (which should be load by default) in the same http doc directory, and to keep existing Drupal functions (a few webforms).


texts: Exclude current NID in View block removes block from Views page without NID

texts:
Drupal 8.9.6
I have a View block that shows n nodes from an entityqueue, and gets displayed throughout the site, including on pages created by Views (i.e., are not content nodes and have no NID). I've added a Contextual filter to exclude the current node's NID. The block works fine on content nodes, but does not appear at all on a page created by Views. I've tried adding the path of the Views-created page to the Exceptions in the contextual filter: Content: ID, but that seemingly has no effect. How can I ensure this block is visible on a Views Page while excluding the current node from the View on content pages?


texts:
Filters on Views only give the possibility for static values. I want to show only nodes with a node ID that is an odd number.

Using PHP code, this is what the filter should do:

if ((nid % 2) == 1) {
  return TRUE;
}

Can anyone tell me how to do this?


texts:
I have a problem with a site I'm developing in which I have a US map with each state as a polygon defined in an svg. Each of those polygons is wrapped in a link so users can click on a state to be taken to information about that state.

Code layout:
<svg...>
  <a xlink:href="...">
    <polygon ...><title>{stateName}</title></polygon>
  </a>
</svg>

The problem I'm having is when someone clicks one of these links I get several errors:
TypeError: this.href.match is not a function in googleanalytics.js line 36, col 66
    ...rupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:///i))
TypeError: target.protocol is undefined in overlay-parent.js line 575
    if (href != undefined && href != '' && target.protocol.match(/^https?:/)) {

After some experimentation I narrowed it down to those functions having undefined events.

The googleanalytics.js function is:

...
$(document.body).bind("mousedown keyup touchstart", function(event) {
...

The overlay-parent.js function is:

...
Drupal.overlay.eventhandlerOverrideLink = function (event) {
...

I assume this has something to do with the links being nested in the svg for some reason but I can't find any good information on why or how to get around that.

I tried using a jquery.svg.js plugin but that had no impact.

Using:
Drupal 7.34
jQuery 1.10.2 (via ajax.googleapis.com)
Google Analytics 7.x-2.1 (googleanalytics.js)
jQuery Update 7.x-2.4 (replace/misc/1.9/overlay-parent.js)

If any other info is needed to help figure this out let me know.

Thanks in advance for any help you can provide!


texts: Does the summary area support input filters?

texts:
I have noticed that text filters placed in the summary area don't seem to work, that the raw text appears in the summary info when posted in Twitter, Facebook and the like.

Is that some inherent problem in the summary area, or is it something like the Metatag filter that sends the unfiltered text directly to Twitter and Facebook?

I will check whether the Metatag output can be filtered in the mean time.


texts: Operations between the same field of a content type

texts:
I feel like this is a very basic question, but after a couple of years it is the first time I need something like this and I cannot wrap my mind around the structure and get an idea of how to acomplish it.

Lets say I have a content type called "Fruit" where I store data in the fields "Name" (text), "Description" (text), "Price" (integer), "Date" (date).
In a view I'd like to select the fruit with names "Pear" and "Apple" with their respective prices for the dates inserted, but also make mathematical operations on the prices of the fruit (Like, "The price of apples was the 3/4 of the price of pears"). I cannot think of a way to do this since it is actually the same field, only grouped by some other field.

Any suggestions?


texts: How to show the webform submission page as pop up?

texts:
I have created the webform with two fields. When I submit the webform, its redirecting to the submission page.

Now, I want to display the webform submission page as pop up.

Thank you message and the "Back to form" should display in the pop up.

I have tried up with the NG lightbox to display the message. But its redirecting to the page with the pop up function.

How to achieve this thing, Please guide me.


texts: Remove inline JS from specific page type?

texts:
This is an answer how to unset js from specific page types:
https://stackoverflow.com/questions/10138660/how-to-remove-css-and-js-from-a-certain-content-type-in-drupal-7
And I've made it for Syntax Highlighter module's js:

function tlito_theme_js_alter(&$js) {
  if (arg(0) != 'node') {
    unset($js['sites/all/libraries/syntaxhighlighter/scripts/shCore.js']);
    unset($js['sites/all/libraries/syntaxhighlighter/scripts/shAutoloader.js']);
    unset($js['sites/all/modules/syntaxhighlighter/syntaxhighlighter.min.js']);
    unset($js['images/syntaxhighlighter.autoloader.js']);
  }
}

And everything is ok but also module adds inline JS that gives error on pages where js ar removed. Inline js is this:

<script type="text/javascript">
<!--//--><![CDATA[//><!--
SyntaxHighlighter.defaults.toolbar = false;
//--><!]]>
</script>

How can I remove inline js from $scripts in my template.php ?


texts: How do I alter a message in the message queue independent of site language?

texts:
I want to programatically alter a message in the message queue. The message I want to alter is set in the message queue by function comment_form_submit() in comment.module, i.e.:

if ($comment->status == COMMENT_NOT_PUBLISHED) {
  if (!user_access('administer comments')) {
    drupal_set_message(t('Your comment has been queued for review by site administrators and will be published after approval.'));
  }
}

Instead of this, I want the call to drupal_set_message() to be this:

drupal_set_message(t('Your comment will be published when you validate your e-mail address.'));

How do I do this?

Postscript: Based on the answer below by Topsitemakers, I got this working for any language by using array_search() inside a custom MYMODULE_comment_submit to search the message array, and then compare the translated strings to identify the key of the string to alter.

This is the working code I ended up with:

$mm = drupal_get_messages('status', TRUE);
$key = array_search(t('Your comment has been queued for review by site administrators and will be published after approval.'), $mm['status']);
if (FALSE !== $key) {
  $mm['status'][$key] = t('Your comment will be published when you validate your e-mail address.');
}
foreach ($mm['status'] as $msg) {
  drupal_set_message($msg, 'status');
}


texts: How do I initially show 3 blank fields on a form when cardinality is unlimited?

texts:
I have created a field programmatically that has 'cardinality' => FIELD_CARDINALITY_UNLIMITED. This is the functionality that I want. I want users to be able to add as many items as they need to. However, when the form first shows, I'd like to have 3 blank fields ready to be filled out before having to click the "Add another item" button. Is this possible?

Lots of answers on the web about how to set the cardinality, but that's not what I'm looking to do. I just want to show 3 blank ones to get started while still keeping my cardinality as unlimited. I hope this question makes sense.


texts: Remove novalidate attribute from webform for client side validation

texts:
I have installed webform and client side validation extensions on my drupal project. The problem is in the webform's form element novalidate attribute is appearing, which cancels the client side validation.

In webform general settings I have unchecked the disable client side validation:

And finally in my form settings I have unchecked the disable client side validation:

Cleared cache but the novalidate attribute is still showing. Is there any way to remove this attribute from the form?


texts: In Ubercart, can I make a "View Cart" link appear only when an item is in the user's cart?

texts:
Ubercart is only a small part of our site and we only want the default cart block to appear when a user is in that shopping section. Simple enough to do with "Show block on specific pages" rules.

However, when a user navigates away from the ubercart section, the cart block disappears, but I would still want to denote that the active cart exists. I don't want users to think their cart has completely vanished.

Preferably it would be a simple, tiny "View my cart" link to the default Ubercart cart page in the Header Block region. Or even added to the end of the main site navigation menu.

So, to reiterate, how can I make a Block (or menu link) render only when an item is placed in a user's cart?


texts: How to make a node reference field that can also behave as a text field if no reference exists

texts:
I'm looking for a flexibly way to allow a user to input a a field, but also to have that field be a node node reference if the the node reference already exists. In other words, lets say I have a content type called dog, each dog has a node reference for favorite toy, if the toy exists, this field should be a node reference, otherwise the user should be allowed to fill it in.
     Conceptually I can think of two way to do this. One way, is just to make it a field, and then somehow link to another node if it exists. The other is to make it a node reference, and perhaps somehow auto - create the node when the user fills it in.

Recommendations? (using drupal 7)


texts: What is the best way to put comments section to user profile

texts:
I need add ability to add comment for user profile. What i am thinking is, create a content type with empty body and leave just comments, and afterwards insert that node to user_profile.
But i don't know how to append comments to user profile tpl file. How to do this, or maybe other suggestions?

  After some research i decided to make my own module to add comments on
  user profile, i will make a block and insert this block to only user
  page user/*, and will track user id to show proper comments.


texts: How to give access custom module to individual users?

texts: I have a custom modules name "Employee Entry" and i want that module show only some of the users under a specific role. Like if i have a role office then i want there is few people who can access the content of that module. There is a by default option to give access to whole role but there is no option to give access for specific users.


texts:
I have disabled Cache pages for anonymous users from Drupal admin admin/config/development/performance.

I have set my site to point on 2 domains such as www.ex1.com and www.ex2.com. One domain is for german language and one is for English. All is working fine on my localhost where there is no memcache. But on my live server front page is getting cached.

In settings.php I have settings like below:

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
$conf['memcache_stampede_protection'] = TRUE;
$conf['cache_default_class'] = 'MemCacheDrupal';

// The 'cache_form' bin must be assigned to non-volatile storage.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

// Don't bootstrap the database when serving pages from the cache.
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;

$conf['memcache_servers'] = array('memcached:11211' => 'default');
$conf['memcache_bins'] = array( 'cache' => 'default',
        // Any bin that goes to 'none' will fall through to database caching.
        'cache_form' => 'none', );

Do this can help like adding below line ?

$conf['memcache_bins'] = array('cache' => 'default',
                                 'cache_page' => 'pages',
                                 'cache_block' => 'blocks');

setting pages cache to point cache_page.

Please suggest. That will be great if someone can explain that how we stop cache_pages when we are using memcache.

UPDATE: Its happening with only view Titles ie: titles get cache if I visit one domain first and then second. It shows title language from first domain into second domain.

Thanks!


texts:
I have a node type with its revisions set to ON
I am not sure this is a bug on my copy or Drupal 6 doesn't save any revisions for CCK fields in the node and only does that for title and body?


texts: Separate Domain users get redirected to Default domain upon login and content save

texts: I have set up Domain Access module in Drupal correctly, and everything works fine but with an issue. The issue is, that when a subdomain user logs in with his account from his assigned domain, he gets redirected to main domain and finds an access denied page. Then he manually goes to subdomain.domain.com and it works fine then. Similarly, if he save any node from his assigned domain, node works fine, is shown only upon his domain, but upon save, he is redirected to the main domain, and the node path is maindomain.com/urlalias, which causes him to show access denied.If he then goes to subdomain.com/urlalias of the node he just created, it shows fine without any problems. How to settle this issue, I have spent days sorting it out but still no success


texts: Need help with how custom fields are displayed by article.html.twig file

texts:
Noncoder here. After not poking my head under the hood of any CMS in years (not since Drupal 5, I think — and I wasn't very good at it even then), I'm working on a portfolio site. I suspect this question will be an easy one to answer for anyone with even modest coding experience; sadly, I can't claim to have even that.

This site will showcase previously published material, and it has to display the original publication date instead of the date that the content was added to the website. It also should display the name of the original publication.

I've created two fields for my article content type:

field_publicationdate
field_originalpublication

I would like the content to be displayed like this:

(Title field)
"Originally published in " (orginalpublication field) " on " (publicationdate field) [note: I'd like this to be consistent with the theme's custom date display format of 'F d, Y']
By (author)  (time to read)

It currently reads:

(Title field)
(date content was added to Drupal)    By (content creator)  (time to read)

I'm now in the node--article.html.twig file.

Someone who was helping me pointed me to lines 28 and 30 of the attached screencap, assuming I had enough basic knowledge to take it from there. While flattered in by this person's confidence in me, as I mentioned in my first paragraph, I'm an idiot when it comes to this stuff.

Can someone help?


texts:
I have some data to be extracted from external sources. I want to display those data in a custom template tpl page ( page--zzz.tpl.php ) . I had implemented hook_node_view in my module, and with the node->nid, output the data to be displayed on a node.tpl.php page.

However, the designer wanted to use the full width of the page, so I had to display the collected data in the page-zzz.tpl page, instead of just in the node.tpl.php, so I have moved my function for collecting the data from my module to the template.tpl.php, and inside the function template_preprocess_page, with the node->nid, I collect the same data.

Is that correct? Everything would have been much easier if I had been able to access to the $page variable inside of the hook_node_view function. I tried but I did not succeed!!!

Please advice me. Now it is working but I am hesitating whether there was need to move the collecting data function from my module to the template tpl page.


texts: Disable breadcrumb on View in Drupal Commerce Kickstart

texts:
I am using Drupal Commerce Kickstart. I have been able to disable the hard coded menus by this advice - specifically my own post at the bottom. Unfortunately this has not disabled the breadcrumbs on certain Views I have created. The Views in question show a single product. One of the views shows content: Full content and the other just draws in node fields from the products. I have a view that doesn't call in any products and this does not show the breadcrumb trail.

The breadcrumb must be hardcoded somewhere as it doesn't appear in the blocks area. It seems to be set to show the breadcrumb in the preface first area.

I would appreciate some advice on where to disable this breadcrumb. Failing that are there any tools in drupal that you can use to trace back to find where things (like the breadcrumb) are getting generated from?


texts: How to add javascript to theme_preprocess_user_login

texts:
I have working code in my theme's template.php file that adds "autofocus" to my modal login form, but Firefox ignores ajax autofocus fields (only applies autofocus on pageload). So I'm trying to add some js to set focus when the modal login form is called. I currently add autofocus via:

function mytheme_preprocess_user_login(&$variables) {
  $variables['form']['name']['#attributes']['autofocus'] = array('autofocus');
  $variables['rendered'] = drupal_render_children($variables['form']);
}

And I'm trying to add js to set focus as a fallback this way:

function mytheme_preprocess_user_login(&$variables) {
  $variables['form']['name']['#attributes']['autofocus'] = array('autofocus');
  $variables['form']['#attached'][js][] = path_to_theme() . "/js/focus.js";
  $variables['rendered'] = drupal_render_children($variables['form']);
}

but this doesn't seem to add the js as expected. How can I add either inline or external javascript to my modal login form?


texts: How to migrate a value into a field attached to a taxonomy_term (from CSV using YML)

texts:
I'm trying to migrate a CSV file of taxonomies (cities) into Drupal 8. The CSV has a code and the city name, for example:

City_Code,"Name"
1234,"CITY A"
5678,"CITY B"

I have the following as my current migration, which is working, and importing the city names. My problem is I also added a field with the machine name field_legacy_id to my term (Drupal 8), which I would like to populate with the OLD City_Code for reference later.

langcode: en
status: true
dependencies: {  }
id: cities
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: null
label: 'My Import'
source:
  plugin: csv
  path: /path/to/data.csv
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - City_Code
  column_names:
    0:
      City_Cd: City_Code
    1:
      Name: Name
process:
  vid:
    plugin: default_value
    default_value: city
  name: Name
  field_leagcy_id: City_Code
destination:
  plugin: 'entity:taxonomy_term'
migration_dependencies: null

The field_legacy_id seems to be ignored and I can't figure out how to get the migration to populate the field value. Thanks.

Edit: This is the field attached to the taxonomy.vocabulary.city:

langcode: en
status: true
dependencies:
  config:
    - field.storage.taxonomy_term.field_legacy_id
    - taxonomy.vocabulary.city
id: taxonomy_term.city.field_legacy_id
field_name: field_legacy_id
entity_type: taxonomy_term
bundle: city
label: legacy_id
description: ''
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings:
  min: null
  max: null
  prefix: ''
  suffix: ''
field_type: integer


texts:
I am wondering if there is any available module in 7 that creates some simple blocks?

I need to be able to use script and iframe tags in the blocks but neither input formats nor modifying them through admin panel is required. They just need to be secure and cache-able to scale well.

(I don't want to create blocks from admin panel, as they showed to be vulnerable to code injection which I explained here).


texts:
I have created a block in custom block library, i need to render the block on all pages except home page.

Unfortunately I need to do it in twig file only because of ui issues if I enabled in the block layout UI

In twig file how can I render the block in drupal 8.

Thanks


texts: How to display all record from database in Drupal?

texts:
global $user;
$nid = '650';

$query = db_select('field_data_field_batch_reference');
$query->fields('field_data_field_batch_reference', array('field_batch_reference_target_id'));
$query->condition('entity_id', $nid, '=');
$result = $query->execute()->fetchField();
drupal_set_message($result);


texts: Remove a content type from search results

texts: How do I go about removing a content type such as webforms from the site search results?


texts: Any idea on how to include a an option in display handler in views

texts: I want to include a check box below pager options i achieved it with form alter  . The problem is how can i retrieve or store the value which user has selected and use that value for further process in views


texts: Cron not running - any symptoms to check?

texts:
I have cron set to run every 3 hours on /admin/config/system/cron (D7's poormanscron). I can run it manually just fine from that page, but over the course multiple days it simply won't run by itself. Nothing in the "Recent Log Messages" (except the "Cron run completed." for the times I manually ran it, aka 3 days ago). Multiple users accessing the site (anon & reg'd), so it should be firing.

Anyway, any obvious places y'all can think of to check what may be going wrong? Worst case I'll just set up a crontab. Website is http://community.habitrpg.com/


texts: Why this code doesn't send an email with drupal_email()?

texts:
I am developing a Drupal 6 module that should send an email after a form is submitted. So far, I wrote the following code.

function mailform_mail($key, &$message, $params) {
  $headers = array(
    'MIME-Version' => '1.0',
    'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
    'Content-Transfer-Encoding' => '8Bit',
    'X-Mailer' => 'Drupal'
  );

  foreach ($headers as $key => $value) {
    $message['headers'][$key] = $value;
  }
  $message['subject'] = $params['subject'];
  $message['body'] = $params['body'];
}

/**
 * Form submission handler.
 */
function mailform_form_submit($form, &$form_state) {
  $valid_email = $form_state['values']['email'];
  $subject = $form_state['values']['Subject'];
  $body = $form_state['values']['body'];
  $params = array(
    'email'=> $valid_email,
    'body' => $body,
    'subject' => $subject,
  );

 // The first argument of drupal_mail() function must match the first part of the hook_mail function.
 // Therefore the first argument is  'mailform_form' and the the mail hook is 'mailform_form_mail'
 // For more infoormation see:
 // - http://api.drupal.org/api/function/drupal_mail/6
 // - http://api.drupal.org/api/function/hook_mail/6
 if (drupal_mail('mailform','reply', $valid_email, language_default(), $params, $from, TRUE) {
    drupal_set_message('An email has been sent to ' . $valid_email);
  }
  else {
    drupal_set_message('There was an error sending your email');
  }
}

Using this code, I can get the values after a form is submitted, but the mail is not sent out.

Is there anything wrong with the code? The module machine name is mailform.


texts: How can I mass delete multilingual strings when I know only the page that added them?

texts:
Some inappropriately placed t() functions generated a large number of strings that I do not want to translate.  Unfortunately, using the Refresh strings i18n page does not clear these strings.

On the Translate interface page, I can search for the strings one by one and delete them but there are about a hundred so I would prefer to do it another way.  Thankfully, they were all created on two pages, so I can search by the path (/ja/mypage) and delete them that way.  However, I still have to click each link.

Is there a faster way?


texts: Programatically get the webform submission "sid" on submitForm

texts:
I am trying to programatically get the webform submission sid on submitting a webform but failed to get it !

On my customwebformhandler.php file i have the below:

public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
// Get an array of the values from the submission.
    $values = $webform_submission->getData();

    // Get the Webform submission "Sid".
    $sid = $webform_submission->id();

// Show a success message.
    \Drupal::messenger()->addMessage(t("$sid"));

}

but i am not getting any sid value.

any help please ?


texts: Right way to add JS and CSS to node/edit and other forms

texts:
I am making a site with a lots of JS, and I am wondering where I should put the JS code. Optimally I would like to keep the JS with each module and not the theme layer. Some content could be exposed as blocks etc.

But I am having some issues with the cache. In my example I need to add JS & CSS to the node edit form. I have used hook_block_view, but it is cached. So if there is an error in the node edit form, the drupal_add_js & drupal_add_css functions are not called. The same seems to be true for hook_node_prepare.

Where would you input the JS & CSS layer? and are there hooks that get's called even if there is an error in the node edit form?


texts: Ajax callback makes form need to be submitted twice

texts:
I have a fairly extensive form that has a few AJAX callbacks.  If I use the form without the Ajax it submits fine.

However if I use a field that has a callback, when i hit the submit button the form will refresh. (It does not submit, nothing changes, the page just flashes and appears to refresh)
If I then do nothing else, and hit the submit button it will submit normally.

Here is one of the form fields with a callback:

$form['week2']['fieldset' . $i]['lines'] = array(
            '#type' => 'select',
            '#title' => t('Number of Items'),
            '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5)),
            '#default_value' => count($timesheet->days[($i + 8)]['type']),
            '#ajax' => array(
                'callback' => '_nnhr_timesheet_callback_week2',
                'wrapper' => 'fieldset-wrapper-' . $i,
            ),
            '#suffix' => '</div>',
        );

And the Callback:

function _nnhr_timesheet_callback_week2($form, &$form_state) {
    $value = $form_state['triggering_element']['#parents'][1];
    return $form['week2'][$value];
}

What is causing me to have to submit this form twice?  I can post more of it if necessary.


texts:
I am trying to display multiple values of drop down and store it to the database. How could I do that?

Any help would be appreciated.

 $form['options'] = array(
    '#type' => 'value',
    '#value' => array('PA' => t('PASSCAL'), 'PO' => t('POLAR'), 'FA' => t('Flex Array'), 'TA' => 'Transportable Array', 'UN' => 'UNAVCO'),
  );
  $form['Project'] = array(
    '#type' => 'select',
    '#title' => t('Project'),
    '#options' => $form['options']['#value'],
    '#multiple' => TRUE,
    '#size' => 15,
    '#default_value' => '',
  );


texts: InvalidArgumentException when saving a view

texts:
I have a view named News containing Aggregated RSS feeds.  I noticed duplicate articles were appearing.  First I tried to enable Query Settings > DISTINCT, but the duplicates still remained so I disabled DISTINCT. I enabled Use aggregation > YES and added "COUNT(DISTINCT Aggregator feed item: Title) (= 1)" to Filter which seems to do the trick in the preview, however when I try to save the page it results in an error.

  The website encountered an unexpected error. Please try again later.

  InvalidArgumentException: The configuration property display.default.display_options.filters.title.value.value doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core\lib\Drupal\Core\Config\Schema\ArrayElement.php).

Is this something I did wrong, or just a bug in Drupal? How should I proceed?


texts: How to print how many nodes of a specific type a user has created?

texts: I'm making a block to be displayed on a node page that I want to display some information about the author of the node. I need to be able to show the number nodes of different types that the author has created. Any suggestions? I found this which gets me halfway there, but I need to be able to filter it by only the node authors content.


texts: Generate a random image on front page each time it is loaded

texts: I'd like to have a random image appear on the front page of my site each time the page is visited. Is there a module set up to do that? Any suggestions as to how to accomplish this?


texts: Two Factor Authentication for admin/OAuth2 for REST API

texts:
I am building a "headless" Drupal application.  The front-end is in AngularJS using OAuth2 to authenticate to the REST API that I have built.  A client did a security audit and wanted additional security on the Drupal administration interface.  I implemented the TFA module using Google Authenticator and Twilio SMS.  All is good.

Except, calls to the API are requiring TFA completion/validation. This is noted in the documentation. It states to develop a custom plugin that will handle web services connections.

I don't have a problem doing this, but I was wondering if anybody has run into this issue and has the plugin ready for sharing.  I have exhausted plenty of time searching to no avail.


texts: views grouping template change - move 2nd grouping below?

texts:
I've got a Views listing, grouped by two fields. Within this, I have an entity reference with multiple entries.

What I want is to relocate the 2nd grouping title to below each listing. I've got a copy of the views-view-grouping--myview.html.twig in my theme. I'm not sure where to go for suggestions on tackling this. I know I can't affect fields from within this. I haven't yet found any good examples/tutorials that show me how to break apart those Headers. They're in the template as {{ title }}, I know that much. I just don't know how to break that apart and get something like
{{Title.level_1}} and {{Title.level_2}}

So that I can do something like this:

{{Title.level_1}}
{{ content }}
{{Title.level_2}}

Please, someone, anyone? I'm struggling here and I've tried everything. Even tried to figure out a hook to preprocess the view. I've run into numerous problems. the underlying field is a global: custom text field. I'm at a complete loss for how to accomplish something that seems like it should be extremely simple.

maybe I've explained it badly? maybe you need more info?

I've tried using aggregation, that breaks everything. I've tried setting distinct, that does nothing. I've got it grouped twice, because the field I want to show at the bottom of everything appears multiple times - the same number of times that a referenced entity appears. A second grouping by this value gets rid of those, but gives me no means to put it lower.

I also tried using Views Field View. That doesn't work for me, either. The referenced Content ID gives no result.


texts:
I'm having problems with removing the title of comments on my forum.
I'm using the advanced forum module and the 'comment title' option is disabled. Anyone knows how to remove it? Thanks!


texts: How to get archived events based on end date for a content type with a start date and end date field?

texts: Create a content type Event with fields for Start date and End date. Validate the creation of events where Start date cannot be in the past and End date cannot be less than start date. Create a View where the Start date & End date are exposed filters and end date validated as in content creation page. The View should also filter expired events (i.e. Content with expired End date) and displayed in a similar view display named Archived Events


texts:
In a module I use forms. On special occasions I have to start another form in another module.
In this case I would like to do the following:
1 pass the control from the form to the Controller(1) of the module
2 this Controller(1) should then pass the control to the Controller(2) of the other module
3 this Controller(2) should start the desired form

Step 1 and 3 I can perform

Step 2 is still a problem because I read that a controller always must render output.
I do not want to create a new instance of Controller 2 in Controller 1.

Found out that you can return a redirect to another controller. The parameter handling is not yet clear to me, I cannot find a good tutorial about the usage ofRedirect and passing parameters with it.


texts: Workflow RULES - One rule for multiple nodes

texts:
I would like to create a rule that updates a field (to Yes or No) in two different content types A and B.

In my current rule, when all the fields on content type B are filled up, status field of B is updated to Yes.

I want to update the status field of content type A to Yes as well. (Note: In content type B, there is a node reference to A)

Any ideas will be appreciated. Can this be done using Rules?


texts: Keep entity object after getTitle() method in render() method in a custom controller

texts:
I've setup my controller like this:
my_controller:
  path: '/controller/{id}'
  defaults:
    _controller: '\Drupal\Mymodule\Controller\MyController::Render'
    _title_callback: '\Drupal\Mymodule\Controller\MyController::getTitle'
  requirements:
    permission: 'access content'

Now, in my MyController.php I need to load an entity object (for which {id} is the id). Unfortunately, it seems I need to load my object twice.
First, in my getTitle function because this is called first. Then again in my Render() function, which is called afterwards.
When I try to save the entity to my class as $this->entity It gets lost when the Render() function gets called. I tried to load via a constructor or create function, but these do not have access to the {id} slug in a proper manner.
What's the good practice way to make sure I need to load my entity object once for both functions?


texts: Rule to check if a node has a translation?

texts:
Just wondering if I can create a this rule:

1) check if a node (when viewed) has the translations for all enabled languages.

2) If the it doesn't, then create the translation (for all enabled languages)


texts: Update default value of form element with AJAX

texts:
I have an email field on node add form , I want to check if this email exist fill the city field in the same node form , then my code is :

function custom_code_form_car_node_form_alter(&$form, &$form_state, $form_id){
  $form["field_user_email"]['und'][0]['email']['#ajax'] = array(
      'callback' => 'user_ajax_check',
      'wrapper' => 'field-user-city-add-more-wrapper',
      'effect' => 'fade',
  );
}

function user_ajax_check($form,$form_state){
    // load the user then
    $form["field_user_city"]['und'][0]['value']["#default_value"] ="foo";
    return $form["field_user_city"];
}