texts: What is the best method for getting vendor files on the server?

texts:
I'm fairly new to Drupal 8 development, and I've been a little frustrated with the complications that Composer has added. Nonetheless, I'm trying to determine the best way to get the necessary /vendor files on the server.

I understand that Composer recommends that you ignore the /vendor directory. However, if you don't have a build server in place, what's the best method to getting the /vendor files on the server? Is it common practice to load and run Composer on the server, or is that a big no-no?


texts: Should I manually upload these large files?

texts:
I have about 10 large zip files (20Mb) which need to be uploaded to a site once, and once only.  I then want to be able to download them from a block in a sidebar (i.e. not from the main content).

I was thinking that the easiest way to do this would be manually upload them to the site (via ftp), then hardcode links in the blocks to reference the file location.  Does this sound OK?  Does it violate any drupal rules?

The reasons I wanted to do it this way, rather than through the file UI or another module, are that I don't have to worry about the php.ini upload_max_filesize and post_max_size.  Also, I won't have to work out how to use the drupal UI to put a link in a block.

What do you think?


texts: Robust handling of the pager in an Ajax controlled View, when URI is shared with another user?

texts:
I have a gallery content type, it references a number of images. When viewing gallery content, a View renders a gallery image, and a pager set to display a single item at a time allows the user to go back and forth with a link that will change the url.

As a user, I can now copy the URL and send it to someone else, who will see exactly the same image.

Problems show up however, when we decide to load only the new image, instead of the whole page, with JS. Since we no longer change the url, the JS-using user will remain at page=0 all the time, and can no longer share this URL as intended.

I have two suggestions of my own, but I haven't implemented either yet, and would love to hear either comments on those, different answers, or just votes on whichever answer you think is the best.


texts: I need a starting pointo to write a Views Form handler to show a Bulk Operation view field in each row instead of a single button?

texts:
I have a view with a VBO field to execute a bulk operation (Get Vouchers) over nodes.

Each row has a radiobutton (I need a single selection), once you select a node you click the button "Get Vouchers" to execute the bulk operation. So far so good.

I need to show a button "Get Vouchers" in each row instead like you see in the capture below.

As Bojan Zivanovic said I need to write a  Views Form handler but I need starting pointo to write it.


texts: View result alter title link based on content type

texts:
I have view which it has content type filter with more than 1 content type(Eg: A,B). For one specific content type(B) i want to alter the title link to external url(This external url is a custom field in that content type(B) ).

If I alter through Rewrite results using token(custom url),it work fine for the title which comes from B content type, but the title which comes from A content type is going to home page since this custom field is not available in that content type(A).

Please some one suggest on this.


texts: workbench access warning message when I click preview

texts:
Has anybody come across a warning message which appears when you preview content? This message only displays when the workbench access module has been installed and the following setting has been checked 'Require a Workbench Access form element'

The messages:
"*Warning: array_keys() expects parameter 1 to be array, string given in workbench_access_node_form_element() (line 1465 of C:\wamp\www\dev\sites\all\modules\contrib\workbench_access-7.x-1.2\workbench_access\workbench_access.module).*

*Warning: Invalid argument supplied for foreach() in workbench_access_node_form_element() (line 1466 of C:\wamp\www\dev\sites\all\modules\contrib\workbench_access-7.x-1.2\workbench_access\workbench_access.module).*
"

Cheers!


texts:
I work at a university that has switched to Drupal. We have several hundred departments making their own "sites" in our system. Most departments need to be able to upload and change ONLY their own pdf files, images, and documents.

We can make folders for departments but no user will want to scroll through the list to upload something each and every time.

Can a folder system of some sort tie in to individual users or groups?


texts:
I have a site with multisite settings

There is one main site, where all the news are created and those are gotten by the other sites via a direct db_query via a taxonomy tid. This is the part that I managed to work after all.

Now the problem.
When I create or update a news node on the main site, the others have to be somehow notified of this. But I don't know how I can clear the cache of a different site

Is there some module which can do this?
If not, do I have to delete from cache tables directly on hook_node_update(), hook_node_delete(), hook_node_insert() ?
If yes, which table(s) does drupal store the cached rendered output (or doesn't she?)?
…
I cannot use drush


texts: Show/hide views on content-type based on taxonomy-terms

texts:
I have an activity-content-type with a taxonomy field, where I can choose from different taxonomy terms related to the activity. Now I have different views and I want to show the specific view on every activity-page, which is related to the chosen taxonomy-fields.

Lets say I have different bike-tours and diff. hikes (activities). Some are for beginners and some are for pros - some are for families and some are for couples and so on. Now I want to cross-link between the different activities and give more inspiration regarding suitable activities. If someone clicks on a bike-tour that is tagged with "beginners" and "families", drupal should show a view that offers other activities (bike-tours and hikes) that suit that criteria - also tagged with "beginners" and "families". Something like "Other familyfriendly beginner activities".

The machine names of the views don't relate with the chosen option at the moment. I would need to build a view for every combination at the moment - this is fine now (few combinations) but not scalable. I thought about combining all in one view (ideal), but couldn't find a solution yet.

Emanuel


texts: Eliminate the "Upload" button in Webforms

texts: There is a way to eliminate the "Upload" button in Webforms, just adding an "attach" button that uploads the file automatically when you push "send", like in the image.


texts: How to remove the Themekey module after its Installation failed?

texts:
I installed the module ThemeKey, but the installation failed with a WSOD. Now every page gives me the same 'The website encountered an unexpected error'.

So I need to remove themekey, but how can I do so? The watchdog table doesn't include any message relating to this problem, so is no help. Can I disable/remove it via the database, or am I stuck with rebuilding the whole system?


texts: Ajax http request terminated error while installing a Drupal 8 site

texts:
I have installed WAMP Server for Postgresql and during the time of installation of Drupal (version 8), I got this error:

  Drupal\Core\Config\UnmetDependenciesException: Configuration objects
  (block.block.bartik_search,
  core.entity_form_display.node.article.default,
  core.entity_form_display.node.page.default,
  rdf.mapping.comment.comment, rdf.mapping.node.article,
  rdf.mapping.node.page, rdf.mapping.taxonomy_term.tags) provided by
  standard have unmet dependencies in
  Drupal\Core\Config\UnmetDependenciesException::create() (line 89 of
  core\lib\Drupal\Core\Config\UnmetDependenciesException.php).
  Drupal\Core\Config\UnmetDependenciesException::create('standard',
  Array)
  Drupal\Core\Config\ConfigInstaller->checkConfigurationToInstall('module',
  'standard') Drupal\Core\Extension\ModuleInstaller->install(Array, )
  install_install_profile(Array) install_run_task(Array, Array)
  install_run_tasks(Array) install_drupal(Object)

How can I solve this?


texts: name of last person who modified node - Display suite

texts: with Display suite in Drupal 7 I can get the last modified date , but how can I display which user did the last modificatioin?


texts: Patterns module : Simple YAML to XML format of the variable tag of the System Component

texts:
I am using the Patterns module to automate and make the profile maintanance easier.I have a simple problem, although it seems easy to write the XML to modify a variable tag, the only examples i can find is in the YAML parser, or the D6, not the XML i am using.So one could say that the following YAML example :

# YAML Variables Pattern
# QScience

info:
  title: Modify variables
  description: New test case adapted to new syntax
  author: QScience
  category: System
  version: 1.0
  core: 7.x
  author_website: http://qlectives.eu/
actions:
 - modify:
    tag: variables
    - variable
      name: user_picture_file_size
      value: 800

could easily ported to XML format like :

<pattern>
 <info>
    <title>Modify variables</title>
    <description>New test case adapted to new syntax</description>
    <author>Qscience</author>
    <category>System</category>
    <version>1.0</version>
    <core>7.x</core>
</info>
<actions>
    <modify tag="variables">
        <variable name="user_picture_file_size">800</variable>
        <!--<variable name="max_amount_limits" value="6000"/>-->?
    </modify>
</actions>

but this doesn't work, keep getting validation errors of missing mandatory attributes name and value, what am i doing wrong?

thanks


texts: Add placeholder/help text to Views exposed filter?

texts: Title pretty much says it all. I am looking for a way to add placeholder/help text to a Views exposed filter. This would be text that appears in the filter (in this case, search field) before the user enters a value, and then disappears when the filed is clicked or when text is entered into it.


texts: Where is the parent/child relationship between nodes stored in the database?

texts:
I am migrating a site from one CMS to Drupal and I'm working on migrating link structures over correctly. This is something I am going to have to automate because there are over 3,500 nodes of content that I am migrating over.

I can't seem to find in Drupal 8's database schema where the relationship between parent and children nodes are stored. I have been looking for something like a 'pid' or a 'cid' column (parent id and child id, respectively), but I can't seem to find a column like that in the schema.

I know you can make nodes children of other nodes, so I know it has to store this information somewhere. If someone could tell me what table and column this information gets stored in I would greatly appreciate that.

Drupal 8 Database Schema


texts: How do I replace comma with a line break in a views field?

texts:
I am working with a custom view handler that renders a comma separated list.  This field is used throughout the site this way.

Now, I have a new view that needs to render the list using line breaks instead of commas. Is there a way to do this in the view settings?

I don't want to hard-code the new view name in the view handler code to render it differently. Do I have to create a views template to solve this?


texts: How to show hide other content fields when we select radio buttons?

texts:
I have created 2 radio buttons. When i select 1 radio button, then represented field has to display and hide other field represented to next radio button.
When I select radio1, only textfield1 has to display and radio2, only textfield2 has to display.


texts: What is the best way to verify controller arguments?

texts:
For example, I have a path on my site.

Let it be www.mysite.com/year/{year}/month/{month}/day/{day}

Could you clarify me, what is the best way to avoid getting of wrong arguments, such as year/3000/month/15/day/32 ?

Should I verify them inside the function called with the controller? Or is there a separated function or method to verify them, which wouldn't let invoke the controller function in case of wrong arguments?


texts:
I would appreciate a little guidance on where to begin so I don't waste a ton of time looking in the wrong places.

I have a content type that has a number of associated entities appended to it; these all have date ranges on them. I need to create a module that upon hook_node_save() and hook_node_insert() checks other associated entities for various date conditions (do dates completely overlap, or partially overlap) and either adjusts the dates on those entities, or deletes the entity.

I know how I'd do this if it was purely SQL, but I want to do it the Drupal way.

How are SQL queries properly handled within a module?


texts: form_set_error Not displaying error after invalid form submission

texts:
I've created a form using my custom module. At the validation handler, I'm calling form_set_error() but no error messages are being displayed.

Also, I've marked several fields as '#required' => true; do I need to validate them manually? I thought Drupal will be validating them automatically and displaying error messages. But I see no error message for them, when I submit invalid data (i.e. not providing any value for the default fields).

This is the code in the implementation of hook_menu() that defines the callback for the page containing the form.

function myModule_menu() {
  $menu['user/signup'] = array(
    'title' => 'Signup',
    'description' => 'Sign Up',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('myModule_signup'),
    'access callback' => TRUE,
  );

    /// Others
}

The rest of the code is the following one.

function myModule_signup($form, &$form_state) {
  $form['user_email'] = array(
    '#type' => 'textfield',
    '#size' => 15,
    '#required' => true
  );

  $form['user_name'] = array(
    '#type' => 'textfield',
    '#size' => 15,
    '#required' => true
  );

  $form['user_passwd1'] = array(
    '#type' => 'password',
    '#size' => 15,
    '#required' => true
  );

  $form['user_passwd2'] = array
        (
    '#type' => 'password',
    '#size' => 15,
    '#required' => true
  );

  $form['user_gender'] = array(
    '#type' => 'select',
    '#options' => array('male', 'female')
    // '#size' => 15,
    // '#required' => true
  );

  $form['user_age'] = array
        (
    '#type' => 'select',
    '#options' => range(18, 26),
    // '#size' => 15,
    // '#required' => true
  );

  $form['user_country'] = array(
    '#type' => 'select',
    '#options' => array('Bangladesh', 'USA'),
  );

  $form['user_state'] = array(
    '#type' => 'select',
    '#options' => array('Dhaka', 'Chittagong', 'Mymensing'),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Sign Up')
  );

  return $form;
}

function myModule_signup_validate($form, &$form_state) {
  $formValues = $form_state['values'];
  if (empty($formValues['user_email'])) {
    form_set_error('user_email', t('Email can not be empty'));
    dsm('I can see this message...');
  }
}

And I'm also calling <?php print $messages; ?> in my custom theme's page.tpl.php file.


texts: Re-enable forum commenting on a topic 24 hours after an admin has disabled them

texts:
I would like an to have my Drupal forum set up so that an administrator can disable comments (by selecting disable comments in forum topic) for a particular topic, but then 24 hours later have comments opened up again automatically.

Can anyone help?


texts: XML Source Won't import without a Source ID

texts:
I'm using Drupal 8's Migrate API to pull in an RSS Feed as Nodes. The simple_xml data parser seems to require a Unique ID for the import or else I get an error on import.

The XML data is coming from the internet and only has one field applicable as a unique id, however it is preceded by a URL. I process the field with the substr plugin in order to pull in the ID, but when I run the import I get the following error message :

Migration failed with source plugin exception: field_guid has no value

The YAML file includes the following:

  source:
    plugin: migrate_gitem_xml
    data_fetcher_plugin: file
    data_parser_plugin: simple_xml
    urls:
      - www.somesite.com/source/xml-source.xml
  item_selector: '/rss/channel/item'
  ids:
    field_guid:
      type: integer
   fields:
    -
      name: title
      label: 'Title of the Item'
      selector: title
    -
      name: link
      label: 'Link to the Item'
      selector: link
    -
      name: body
      label: 'Body'
      selector: >
        content:encoded
    -
      name: guid
      label: 'ID of the Item'
      selector: guid
  process:
    type:
      plugin: default_value
      default_value: content_type
    uid:
    -
      plugin: default_value
      default_value: 1
    title: title
    field_link: link
    body/value: body
    body/format:
    plugin: default_value
    default_value: basic_html
    changed: '@created'
    field_guid:
    -
      plugin: substr
      source: guid
      start: 61
      length: 6

Any insight on how to get the Migration to work?


texts:
How can I use the API and hooks of a contributed module, I am trying to use relations module to add my functionalities using that module but I could not find any documentation that help me to do that

Any help?


texts: Pictures are not responsive on Firefox & Internet Explorer, Using grid on views

texts:
I am building a site with a lot of pictures.
On Google Chrome Everything is working fine.

On FF & IE, If I am just viewing the content & picture not through a view - everything is fine.
But, the pictures are not responsive when I am presenting the picture using views.
I read & saw many tutorials regarding breakpoints Module, Picture Module, and more.
On the picture field on views, I chose the right Formatter, picture group and Fallback image style.

I am using zen sub-theme, but the problem also occur on other themes I tried.

If there are other modules that can fix this issue, or you can help me solve the situation currently, it will be great.
Any Ideas?

Thanks!


texts: How to access an external MySQL database in a view if SQLite support is not installed?

texts:
I would like to display other MySQL database by Views, and having the similar situation as this question. Except, I'm not able to enable the "SQLite", because I have no control on the server end. While adding the data block on New Forena Report, I got the message "PDO driver support for sqlite not installed", as shown in the screenprint below:

My question: Is it possible to display other MySQL data by Views without installing and enabling support for SQLite? What are my other options?

===== Updated June 6, 2015 at 12:45pm - Data block format ====
Below are the screenshots where I fix the Data Block format for data column with double quote.

screenshot 1 - While you edit the Forena Reports, you actually can configure each column(block) by left click the gear as screenshot from blow.

screenshot 2 - Choosing the "drupal_text_format" format will remove double quotes


texts: How to insert drupal username and email fields into create booking form?

texts:
Am using the Booking Time slot module. The module introduces a "Booking entity".

I want to insert the default drupal 'username' and 'email' fields into the form used in creating a new booking, so that user is able to register while completing form.

Assuming "Booking" was a "Content Type", I would use the inline registration module. However, that option does not exist in this case.

Is there a way to insert the fields or merge the 2 forms?


texts: Programatically add CC addresses to the webfom

texts:
Can anyone help we with the code which would add the CC to the webform? I need the CC feature, so my users can "Reply to All" when the communicate.

Thanks!
Anton.


texts: How to restrict moderators to only access a limited set of users?

texts:
I have 2 user roles: Moderator and Company. Each Moderator has a set of companies; for example:

Moderator A owns Company d, e, anf f
Moderator B own Company g, h, and i

When moderator A logs in, I want that moderator can only see Company d, e, and f. I want to use a view.

How can I achieve this? How can I restrict each moderator to see those companies (which, I repeat, are user accounts) they own?


texts: Drupal users getting blocked automatically

texts:
I am experiencing a strange problem with my drupal website. On it, there are a good number of registered users. Sometime the users login, but not very frequently. Suddenly I figured out that some of the users (who are relatively old) are getting blocked. I check with blocked users, they said they did nothing. I do not have any idea how they got blocked.

Ok, then I unblock them manually and now they are active. Next day, I find them blocked again. So, now I need to unblock a bunch of users manually which is not the optimal way to deal with the users.

Anyidea? Anybody?

Thanks,


texts:
I am currently developing a module with a custom content type. In the node/add for this content type, I need to be insert a form that can retrieves data from an API, that will later be displayed on the page.

What is the best way to insert that form into the node/add page?

Should I use a hook_form_alter? Or should I make a custom field? This portion of the form will most likely involve AJAX, so I don't know if that will change anything.

Let me know if I need to clarify anything, and thanks in advance!


texts:
I have a D8 subtheme of Bootstrap and on the homepage I have 2 Views (2 carousel views).
I turned on twig debugging so I could see which template file(s) is (are) being used, and where it starts and ends.  When I used this before it included a listing of sample alternate filenames for that specific content (e.g. paragraph--about-us-page--full.html.twig), which was a big help.
For each of the views on the homepage, they are shown using views-view.html.twig and views-view-field.html.twig whether from the module template, bootstrap template or my copy of the files into my theme.
Is there a way to set up a template file for each of the views individually?
View Machine Names:

homepage_slider
homepage_loans

They only reside on the front page.  I have tried renaming files to see if I can see it being used in the Twig debugging and frequently clear the cache.
It could be a Page, View, Block, etc. template, but then how do I reference the parts of the View to control the display of the fields.
Thank you.


texts: Programmatically get the results of a view

texts:
Using the group module in D8, I have the below view with machine name: group_members_per_group

Machine Name of:

(Member account) User: Full Name is: field_user_full_name
(Member account) User: Phone Number is: field_user_phone_number

The above view has the below results:

On cron run, and while Looping through all rows of the view results, I want to get for each row the field_user_phone_number value so I can use it with other code.

So I wrote:

function my_module_cron() {

// Get and loop through the View `group_members_per_group`
//$args = [$gid];
$view = \Drupal\views\Views::getView('group_members_per_group');
//$view->setArguments($args);
$view->setDisplay('default');
$view->execute();

// Get the results of the view.
$view_result = $view->result;

// Check if the view is not empty and return results.
if (!empty($view_result)) {

// If the view returns results...
foreach ($view->result as $row) {

// Get the full name value.
$name = $row->field_user_full_name;

// check the result output for testing only.
\Drupal::messenger()->addMessage(t($name));
  }
 }
}

However, on cron run, I am receiving the below error:

  Notice: Undefined property: Drupal\views\ResultRow::$field_user_full_name in my_module_cron() (line 103 of modules\custom\my_module\my_module.module).
      my_module_cron(Object)
      call_user_func('my_module_cron', Object) (Line: 316)
      Drupal\ultimate_cron\Entity\CronJob->invokeCallback() (Line: 459)
      Drupal\ultimate_cron\Entity\CronJob->run(Object) (Line: 24)
      Drupal\ultimate_cron\Controller\JobController->runCronJob(Object)
      call_user_func_array(Array, Array) (Line: 123)
      Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 582)
      …
      …

Line 103 in the error is:

$name = $row->field_user_full_name;


texts: How to show a message “field is required” from webform validation?

texts:
When a webform is validated it does not send the Drupal message "X field is required", it creates only the red border around the field.

How would I show the Drupal messages from triggering during validation? It is a block view of webform in drupal 7.


texts: How many products can Drupal Commerce handle?

texts: Are there any limitations on how many products Drupal Commerce can handle?


texts:
I would like to get the published date of my node. On the site I created a news block with a view. In the view I added a field and customised it by the rewrite results with "published on {{ created }}". But sometimes I create the news the day before, then it shows the created date, but I will like to have the published date.

What's the name for the published date? {{ publish_on }} didn't works.


texts: Permissions by taxonomy for taxonomy and nodes

texts:
I have following setup:

Taxonomy Departments (hierarchical in at least 3 levels)

Location A

Team A.1

Subteam A.1.I
Subteam A.1.II
Subteam A.1.III

Team A.2

Location B

Team B.1
Team B.2

Taxonomy "Worker" (taxo ref to "Department")
Content Type "performance review" (taxo ref to "Worker" and to "Department"), one user may have multiple of reviews (they can be done from time to time, like every 3 months)
Users with a specific role ("Manager")

What I need is:

Managers should only see specific departments and all workers in that department
If the manager can see Team A.1 (or Location A) he can see all (Teams and) Subteams also (and all workers belonging to those)
Managers should only see the performance reviews of workers he has access to

The question is:

How do I best go forward to get there?

Problems I found with existing modules and more problems:

You can give node acess based on taxonomy, but those modules don't give access to taxonomy based on taxonomy
To me it would be logic to give the user accounts a new field with reference to the "Department" and build the permissions from there. "Acces by Reference" for example would need me to give the "Department" a reference to users (which you could argue for, but in this project I would prefer the other way (or a synced both-way-solution).
Just in case you wonder about this: The review references the department (instead of always getting it from the referenced Worker taxo), because when workers switch to another department, the review should stay in the department in which it was created

If the only way forward is programming my own module:

Is this a good starting point: https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_access_records/7.x ?


texts: I installed the Civicrm module on drupal but it s not showing in the navigation bar

texts:
I just installed the CiviCRM module on my Drupal website. But nothing new about the CiviCRM module is listed on the navigation except in configurations. And of course i have already set all the permissions for CiviCRM accessible for the administrator of the site.

How i can have access to the CiviCRM module?


texts: Managing user accounts on remote drupal website? (Dev team all needs access)

texts:
My company makes lots of Drupal websites and the biggest annoyance I've seen is having to add each other as a user to each site whenever someone else wants to work on it. We all have the same email address domains as we use google docs.

We currently use openId and login with our google accounts but we have to make everyone a user on each site and they have to activate it.

Is there some type of module that would allow us to all have access to any site if said module was installed? Or that it would allow us to create an admin account because we have and can verify our domain in our email through google apps?

Thanks!


texts:
I did my my own login form with custom functionality that is on /login url. Now I would like to restrict acces to default /user url in order to prevent logging in the old way.

I have a lot of different functionality in this form, so I though it is better to built it all from scratch instead of altering something. And I don't like the word in the /user, since in our language it sounds similar to some word that is not appropriate here.

I've tried to add /user item to hook_menu and define the same callback as /login item has.

I was hoping it could redirect users to new login form, but it had no effect.

What is the right way of doing this?


texts: Add condition to specific content type in apache solr

texts:
I've installed apachesolr,search api solr and views. I have only indexed article and basic page content type.

Then i've added new field "internal use only" as checkbox for article content type. I want to add filter "internal use only" only in article content type. I want to show except those articles.

How to alter apache query?


texts: Why is Solr throwing exceptions on unfound text files after insttalling Apache Solr Multilingual config files?

texts:
I have used Apache Solr Multilingual to generate Solr config files; however after installing these files Solr throws many exceptions of the form :

Can't find resource '<text_file_name>_<lang>.txt'

For example

Can't find resource ' mapping-ISOLatin1Accent_fr.txt'

Is the configuration of such files not the purpose of the Apache Solr Multilingual module ?


texts: How to fix the Invoice module's total amount?

texts:
I recently started using the Invoice module. Everything seemed to work until the moment I was going to make some test invoices.

The total amount is wrong (see figure): 306.81 + 64.43 = 371.24, but on the invoice 371.25. Anyone have any idea how I can fix this?

It does show well in the back-end: The sum from there looks simple? 371.25 - 306.81 = 64.44, this is the only correct result (see figure).


texts: Transfer (export/import) url aliases and menu links automatically

texts: I want to transfer/synchronize url aliases and menu links from one site to another. Is there any way (drupal module, drush command, script) to do it automatically? The module menu_import looked promising but it does not take care of aliases.


texts: Make a password security check for the register form

texts:
I have a register form that is output in a controller using the following code.

 $form = $this->getUserProfileForm();

    return [
      '#theme' => 'maubl_user_inscription',
      '#form' => $form,
    ];
  }

  protected function getUserProfileForm() {
    $entity = \Drupal::service('entity.manager')
      ->getStorage('user')
      ->create(array());

    $formObject = \Drupal::service('entity.manager')
      ->getFormObject('user', 'default')
      ->setEntity($entity);

    $form = \Drupal::formBuilder()->getForm($formObject);

    return $form;
  }

In a custom module, I'm using the following code to alter the password.

function maubl_user_form_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $formState) {
  $form['actions']['submit']['#submit'][] = 'maubl_user_form_login_after_registration';
  $form['account']['pass']['#process'][] = 'maubl_user_form_user_register_form_process_pass';
}

function maubl_user_form_user_register_form_process_pass(&$element, \Drupal\Core\Form\FormStateInterface $form_state, &$complete_form) {
  $element = \Drupal\Core\Render\Element\PasswordConfirm::processPasswordConfirm($element, $form_state, $complete_form);
  $element['pass1']['#placeholder'] = t('Password');
  $element['pass2']['#placeholder']= t('Confirm pwd');
}

Yet, any password would be accepted as long as they are the same. I want something like password_confirm to check if there are special characters, special length etc, but I couldn't figure out how to make it works.

When I try to use the following code, nothing happens.

function mymodule_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form['account']['pass']['#process'][] = 'mymodule_form_user_register_form_process_pass';
}


texts:
Is there a hook one can use on, say, a node edit page that will print the $form array after it has been completely processed? I'm customizing a Paragraph edit form inside a Node edit form and thus altering the Paragraphs Field Widget -> Subform. The subform's '#process' key contains a further function to execute:

But if, say, I print the $form var inside hook_node_form_alter, this #process still has not executed.
The larger problem is that my subform contains a custom submit handler that is not being called when I submit the subform and I'd like to print the entire form array after processing to ensure the submit handler is actually there in the $form array. If the problem of custom submit handlers not firing inside subforms sounds familiar, let me know
EDIT
Relative to the larger problem, this is what my embedded form looks like after all processing completes (i.e. printed in an #after_build)


texts:
Coming from a Drupal background, I am quite thrilled at the idea of working with drupal 8 and symfony proper OOP and MVC practice.
Right now I I am building a module with a service and a controller and I am at a loss regarding where to put my data fetching logic (that should be used by both).
Understanding MVC policy I should put it in some kind of "model" structure but I can't find anything about that in Drupal documentation (sadly a bit lacking at the moment).
So what is the Drupal way for this?


texts: Disable Ubercart "empty cart" confirmation

texts:
My ubercart link uses the -e flag to empty the cart before adding a new item. Users can only purchase one item, it is a subscription site.

If there was something in their cart, ubercart displays a "this action cannot be undone" message and a confirmation button. How to I disable that functionality? (Note: I'm a beginner ;)

I tried using the Drupal disable messages module but it did not work on that message.

I would appreciate your expert information, solutions or guidance.

Thank you!


texts: im trying to make a simple pdf viewer or reader website running locally on my computer. Ive used the pdf reader, follow the instruction in README.TXT but still i can't use this. I can't seem to find the pdf reader. Any suggestion on how to achieve what i want?


texts: How to make an entity reference field required using states

texts:
I need to make an entity reference field in my form be required based on the state, the code below is working with other fields, but not my entity reference field.

$form['schedule_publish_date'] ['#states'] =  array(
 'required' => array(
  ':input[name="moderation_state[0]"]' => array('value' =>"published"),
 ),
);

this is the source code of the entity reference field. Am I putting in the wrong name for the form item?

<fieldset data-drupal-selector="edit-schedule-publish-date" id="edit-schedule-publish-date" class="js-form-item form-item js-form-wrapper form-wrapper">
  <legend>
Schedule Publish Date

the moderation state is not what I am having trouble reaching. It's the schedule publish date, which is an entity reference and doesnt become "required" when it should.


texts: Drupal inline_entity_form table style input

texts:
My custom entity has a entity reference ( with Inline entity form - Multiple values) widget.

On entity edit form I need to show "entity reference" direct edit form in a table row ( in other words each entity should have a horizontal form layout).

How to implement it in custom controller which already extended from EntityInlineEntityFormController ?


texts: Multi-language menu's / menu-items setup

texts:
I might not understand Drupal 8 and the different Multilingual approach completely, but I'm bumping into all sorts of issues.

What I simply want, is a single Menu , containing links from 2 different languages.

To make this happen :

I enabled the Language module, and set-up 1 additional language. Install was done in NL, and I added FR
I enabled the Content Translation module
I checked both 'Content' & 'Menu Link' under, so that I can translate both the Node & the menu title ( admin/config/regional/content-language )
Set the language of the Main Menu to '- Not applicable'. I'm not sure if this is right, but the menu would contain links from 2 languages, so I thought this was best option ( admin/structure/menu/manage/main )

Issue #1 :

When I create a NL node & enable menu-link, all is fine on /nl , but on /fr the menu-link still pops up.
This seems weird, as I have no translation or menu-link for FR.

Issue #2 :

When I click 'Translate' on the NL node, I get the FR edit form. I type my content, and I change the menu link title ( the field is visible & pre-filled with the NL menu link title ).
I now have both a NL & FR version of my node, but my original NL menu link changed with it.
I would assume that automatically , a FR version of my menu link would be created.
However, that's not the case. I have to manually go to Structure > Menus and click 'translate' on my NL menu link

Am I setting up the wrong way ?
Should I go for a separate NL/FR menu ?
Will I have to manually add functionality, to create a menu-item on the fly when I translate a node ?

Has someone done something similar and experienced the same issues? And perhaps have any solutions ?


texts: Is there a native function to sanitize filenames in Drupal 6?  Alternatively, does someone have a function they use that they'd like to share?


texts:
Theme settings are not translatable in core. Is there a way to make them translatable? I have some additional theme settings which needs to have different values per language.

I'm trying to achieve something like this - How do I translate theme settings?

What I have so far -

mytheme/config/schema/mytheme.schema.yml

mytheme.settings:
  type: theme_settings
  label: 'My theme settings'
  mapping:
    custom_textarea:
      type: text_format
      label: 'Additional settings'

mytheme/config/install/mytheme.settings.yml

custom_textarea:
  value: "
*this is an additional settings.
\r\n"
  format: full_html
langcode: en

mytheme/mytheme.config_translation.yml

mytheme.settings:
  title: 'my theme settings'
  base_route_name: system.theme_settings
  names:
    - mytheme.settings

theme-settings.php

/**
 * Implements hook_form_system_theme_settings_alter().
 *
 * Form override for theme settings.
 */
function mytheme_form_system_theme_settings_alter(array &$form, FormStateInterface $form_state) {

  $custom_textarea = theme_get_setting('custom_textarea');
  $form['custom_textarea'] = [
    '#type'          => 'text_format',
    '#title'         => t('custom textarea'),
    '#format'        => 'full_html',
    '#default_value' => $custom_textarea['value'],
  ];

}

When I navigate to admin/config/regional/config-translation it shows the 'my theme settings' but when I click on Translate it navigates to admin/appearance/settings/translate and returns Access Denied.

I also tried updating the base_route_name in mytheme.config_translation.yml to system.theme_settings_theme but when I navigage to admin/appearance/settings/mytheme/translate it throws a fatal error.

Looking forward for any suggestions.


texts: Creating a view of child groups in Organic Groups

texts:
How do you create a View showing all the child groups of a group in Organic Groups?

I've started off with the 'OG Extras Groups' view, which shows all groups. I thought it'd be simple to then just add a filter for 'Content: Parent group', and that would show the children of a selected group. It returns no results, though.

I've tried all sorts of relationships but can't get the child groups to show. This thread is the only information I've found:
https://www.drupal.org/node/159988. The explanation is for D6, though, and I can't see an easy translation to D7.

I've only got five groups so I don't need to set a contextual filter - I can hard code the parent group value (either name or ID).


texts:
It's possible in Drupal 8 disable all users notifications? New account, forgot password, etc

I'm using one external tool to send these emails and I don't need these notifications.

Thanks


texts:
I'm putting together a public facing site with not always mature users, and I'm wondering if there is an off the shelf module for requiring admin approval to user field submissions/changes?

I.e. so that one of our staff get a notification when a user updates some selected settings (My Biography, that kind of thing) and it sits, pending review, before it goes public?

I'm trying to avoid the inevitable genital-graffiti that I know this lot are very capable of...


texts:
I've come to face this issue time and again and I haven't yet found a solution without having to compromise something.

This scenario applies both to admin and front end.

There seems to be a lack of an efficient way to filter Entities according to some of their properties and/or fields.

In my example I'll use Users as my entity.

In multiple occasions I've had to filter users. Either to reference them to a node (entity reference), or to perform a bulk operation (front end - invite them to something or send them an email, doesn't really matter). The requirement would be pretty much the same: A view-like presentation with exposed filters that would allow for an operation to be performed to the selected Entities.

I am aware of Views Bulk Operations but even that lacks flexibility in this aspect, as it "resets" the form in each trigger of the exposed form.

If, I wanted to send an email to all the "Johns" and "Marys" on my user base, I'd
have to filter against "John", select the users that are presented to me, and then filter against "Mary", select all the users that are presented to me, again, and then, either press the submit button or reset the filter to preview my selection.

Thing is that after the (ajax or not) exposed filter submission, the "John" checkmarks are lost, and if I Clear the exposed form, so are the "Mary" checkmarks.

The exposed form submission simply fetches a "fresh" view-form with it's rows filtered accordingly.

On the backend (entity reference) there seems to be some work by the entityrefence_view_widget module but it's still in the makings.

My question would be: How do you tackle such an issue when you face it in your projects? Is there a way I am not aware of?


texts: Commerce - how to allow users to buy 2 free products

texts:
For a current site I am building, authenticated users should be able to order 2 free products (of a certain type), after which the prices are back up to full price. Is there any solution which allows this kind of functionality? I can't seem to find the right words to search as nothing is coming up.

If not, any ideas on how to implement this with Rules / code?

I imagine I would have to add a new line item for the 2 free tickets at $0, and deduct these 2 products from the original line item, but I'm not sure at what stage in the process to do this. Any help?


texts:
I have node reference field attached to profile2 type entity and I can't add new entity to user profile. Even as admin (uid=1).

See my screenshoots for details

view user profile

add node to user profile

save changes and see no changes at all

Big WTF for me. Thought is is permissions related but why it's not working for superuser also. When I'm using IEF with node to node reference all is working.

I need advice how to resolve this issue. What check first, etc.


texts: How do I completely uninstall a custom entity implemented by my module?

texts:
I need to write an uninstall use-case for my custom entity. I just want to know what operations I should take care of, in order to completely uninstall my entity/module and all attached fields (including custom fields created by Field API).

Should I use hook_uninstall and how should I implement this hook?


texts: drupal 7 restful server VS seperate Restful server to access mysql. Can a restful server be on a subdomain

texts:
I am trying to figure out which would be easier to setup and maintain, while keeping the speed average or better.

I have setup a Drupal 7 site on godaddy with their Deluxe 4GH hosting plan.  What I am trying to figure out now, would it be easier to setup and maintain a resful server in drupal 7 or setup a seperate restful server.  I would also like to know if I can run the seperate restful server on a subdomain.  Right now I have the restful server enabled in drugal (nothing setup tho), and I now cannot get past the firewall of the company I work for.


texts: How to check whether the page content is been managed by blocks, views or anything?

texts: I have one webpage (created in Drupal 7) and I am not able to figure out wether the content comes from blocks, views or anything else? I have checked blocks and views but there it is not appearing. How to check?


texts: How to properly check in entity form validation if field is empty?

texts:
I have a content type "A" (Node entity type).
In it's node form (new/edit) I need to check if some fields are empty or not (which are not required in general).
My first intention was to use FormState "getValue", "isValueEmpty", "hasValue" functions, but I can't figure out how to easily solve this problem:

Text fields has value: array("value"=> "") if they are empty, and it's not considered empty by the functions above (so I can't use them)
I could check by myself for isset($field['value']), but there are also file fields and entity reference fields which has a whole different "value" structure.

So what would be a clean way to achieve this?


texts: how to render content type's fields in Custom Module Form

texts:
I'm new to Drupal 8 and I'm trying to create a form that allow to fetch my content types hierarchy and show its fields using ajax callback, but unfortunately none of the fields shows up eventhough the ajax works fine and callback function correctly fired?
The Fields Types in my ContentType is {body:text_with_summary, price:decimal, title:string}
As I Tried with debugging it seems that my code cannot define those types as form field types

here is my code in MyForm.php File:

public function level3SelectedCallback(array &$form, FormStateInterface $form_state) {
    $ajax_response = new AjaxResponse();
    $fields = MyController::contentTypeFields('MY_VOC');

    foreach ($fields as $field){
        $name = $field->id();
        $label = $field->label();
        $type = $field->getType();
        $desc = $field->getDescription();
        $form['fields_wrapper']['field_'.$label] = array(
            '#type' => $type,
            '#description' => $desc,
            //'#options' => '',
            '#attributes' => array(
                'class' => array(
                    'myField'
                ),
            ),
            );
        $ajax_response->addCommand(new HtmlCommand('#fields-wrapper', $form['fields_wrapper']['field_'.$label]));

    }

    $ajax_response->addCommand(new InvokeCommand('#fields-wrapper', 'change'));
    $form_state->setRebuild(True);

    return $ajax_response;
}

My Controller Function is:

static function contentTypeFieldsAsFields($contentType) {
    // Get the definitions
    $fields = array_filter(
            \Drupal::service('entity.manager')->getFieldDefinitions('node', $contentType), function ($field_definition) {
                return $field_definition instanceof \Drupal\field\Entity\FieldConfig;
            }
    );
    return $fields;
}


texts: Properly handling menu items in a custom module

texts:
In my module I need to install custom menu items (add to existing main-menu) on the front-end side. So basically it's a simple one-time operation, yet it rises some questions about the proper way to deal with programatic menu items in general.

hook_install + menu_link_save sounds good for installing the items, hook_uninstall + menu_link_delete - for uninstalling, but how am I supposed to find out the $mlid parameter of the menu link - required by the menu_link_delete function?
Would hook_enable and hook_disable be more suitable?
How do I protect my module's menu items from deleting on the admin UI side?


texts: Store data from a specific content type in a different database?

texts:
Was not able to find a previously asked question. But is it possible and or worthwhile?

Background: setting up a new feature that will host a lot of data. Want to separate it from the rest of the site so if something happens to that data the rest of the site, users e.g will not be touched.


texts:
I'm working on a Drupal 7 project where I use the form API to build a form. I want my form's fieldsets to be collapsed by default.

I use the following code:

$form['fieldset'] = array(
  '#type' => 'fieldset',
  '#title' => t('categories group'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
);

When refreshing the page the fieldset is not collapsed although it has the collapsed class. When clicking on the fieldset for the first time, the  class is removed, while clicking for the second time the class is added and the fieldset is collapsed.

How do I force a fieldset to be collapsed by default?


texts: Programmatically adding fields to node submission form

texts:
I need to add fields to a node creation/editing form programmatically. More specifically, I need to take already-generated form elements from another form and insert them into the node submission form.

That part isn't what's hanging me up though. My problem is that I can't figure out how to make the database hang onto the values submitted via the new field.

For example, the following code (copypasta'd directly from the API Quickstart page) creates a form element inside the existing node form just fine, but when I enter a value and submit the form, the value is not stored.

function [mymodule]_form_alter(&$form, &$form_state, $form_id) {
    $form['foo'] = array(
      '#type' => 'textfield',
      '#title' => t('bar'),
      '#default_value' => t('foo'),
      '#size' => 60,
      '#maxlength' => 64,
      '#description' => t('baz'),
    );
}

How do I alter an existing form in such a way that the submitted values 'take,' so to speak?


texts: How to make Views sorting case-sensitive?

texts:
Ascending alphabetical sorting in a Views string field works like this:

1
2
3
a
A
b
B

But I want it like this:

1
2
3
A
B
a
b

Is there any way to do this?


texts: How to transfer a panel variant from one site to another?

texts:
Is there a way to do this with Features? I can't download and install any additional plugins to do this on this site.

Would anyone know if this is possible?


texts: Where is the 'display post information on' settings?

texts:
I've seen the discussion of this setting, which I gather used to be under theming.

They discuss it being moved to content type, which makes a lot of sense; going through content types in my install, I don't see any option similar to this. Where is it in Drupal 7?


texts: How to add link title in combine field filter

texts: my view having combine field filter.it is working based on link field. the link field title is "test" and the url is "http://example.com".when i search using "test" it is not showing any result.if i search using "example" it shows correct content.how add the title also in combine field filter. anybodys can help? thanks advance!.


texts:
I migrated to drupal 8 and now it has 760 blocks. I plan at least to triple this number. Blocks are placed into nodes content with Insert Block module. When I was setting up website the database was 200 mb, now when cache is not cleared it's 2gb+. There are two tables 1gb each.

At the moment when I save or edit block structure it takes 10 seconds to save it. CPU is't at 100, so website is working fine so far, but I'm worried that it might break down due to very large cache tables.

What do you think I should do to save performance other then stop adding blocks?


texts: View exposed filter with month and remove year

texts:
I have an issue that needs the help of everyone. I created the page in view to filter the node. I created a filter Date created in "view exposed filter" for filter by  Date created.

I configured for the Filter granularity is check month,  that filter will display 2 dropbox to me to choose, i.e. month and year dropbox. But I want to display only months option and defaults year is the current year. Do not know if anyone can help me handle the matter.

Thank you very much


texts: How to change the autocomplete for a user reference to show First/Last name instead of username?

texts:
I want to add a user reference field to an "event" content type, and reference the user who will present.

But I wonder how to change the entity reference - I've tried using the "filter by an entity reference view" with a view I created, but it still only shows the username.


texts: I am working on a Drupal 7 site. When I check the  cache_form table it reaches 4 GB daily so I have to manually truncate the cache_form  table. Is there any way to clear cache_form table automatically 4 times in a day?


texts:
I have enabled https for my site. All images and files are served with https url, but favicon it is serving from http://example.com/sites/default/files/favicon.ico instead it should show as https://example.com/sites/default.files/favicon.ico. When I open the site in Firefox it is displaying below error message in console

  Loading mixed (insecure) display content on a secure page
  "http://example.com/sites/default/files/favicon.ico"[Learn More]

Suggest me a way to resolve this.


texts: How to let users choose one role from 2 offered on their account page?

texts:
I have Drupal 7 installed on my local WAMP server.

I need some simple solution to let users choose one role from 2 offered on their account page AFTER registration.

Is it possible to do it with the Rules module? - when a user follows one of the 2 links he is assigned the corresponding role. The problem is I cannot find the proper Rules Event that could initiate this process.

As the last resort I would probably have to use the Auto Assign Role module.


texts: I am working on an admin interface for a module that uses a custom entity type. Is there a function or some way that I can use to find all entities of a given type, so that I can show users a list of them?


texts:
I have a Drupal 7 installation that apparently leaks memory somewhere. The memory usage of nginx is going up in production until the server fails. This started basically when I added a new node with PHP content to it. My PHP code does basically this:

<?php

global $user;
$token = uuid();
$uid = user_load($user->uid);
$myprofile = 'main';
$profile = profile2_load_by_user($uid, $myprofile);
$birth_date= $profile->field_birth_date['und'][0]['value'];

$conn = mysql_connect ("my.sql.server:3306/somedb", "user", "pass");
mysql_select_db("somedb", $conn);
mysql_query("INSERT INTO special_table (TOKEN, USER) VALUES ('$token','$user->name')");
mysql_close ($conn);

echo 'output some html based on birthdate..';

In addition I use memcached module. That custom DB connection that I have to open and do a single insert is not the DB of the drupal installation, that is going into a separate database. Surely not the nicest solution, but I guess that should not leak anything.

Do you see anything in this code that can possibly lead to memory leak?


texts:
I have a custom form with text field and a submit button.

$form['bid_amount'] = array(
  '#type' => 'textfield',
  '#title' => t("Your Bid"),
  '#prefix' => '
',
  '#suffix' => '
',
);

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => t('Calculate your bid'),
  "#ajax" => array(
  'callback' => 'custom_callback',
  'wrapper' => 'test-ajax',
  'method' => 'replace',
  'effect' => 'fade',
  ),
);
}

What I want to do is, when 'bid_amount' is empty, and button is clicekd, 'bid_amount' should be rendered again with a prefilled value.
This is what I can do.
But at this time, when again button is clicked, with FILLED field of 'bid_amount', it shows up again with suggested value. Actuly it should be submitted this time.

Here is how I am rendering this ....

function custom_callback(&$form, &$form_state) {

    $next_bid = 100;
    return array(
      '#type' => 'ajax',
      '#commands' => array(
        ajax_command_replace("#test-ajax", render($form['bid_amount'] = array(
              '#type' => 'textfield',
              '#title' => t("Your Bid"),
              '#value' => $next_bid,
              '#prefix' => '
',
              '#suffix' => '
',
        ))),
      )
    );
}


texts: How do I change my blog title font size and serif typeface in views?

texts:
I have tried to changed the title formatting with CSS, without success. I may have done something incorrectly. I also downloaded an module that has the ability to format titles in views, but that also failed.

You can see the list of titles I would like to change here: http://www.thepoliticus.com/


texts: How to showing Created time in node teaser?

texts:
I'm using Omega for theming and I want to show created date time in teaser Article.

I found this <?php print format_date($node->changed, 'article') ?>

But I don't know where to put it.

Any Help?


texts: Sorry, but I can not understand how I can make 2 different registration on 2 different pages - I installed and Profile2 Registration Pathom and Profile2 but on 2 different pages it displays the same fields of registration - I did 2 different Profile type but they same registration - help guys.


texts: Error while trying to install drupal commerce kickstart

texts:
I am new to drupal and am trying to install drupal commerce kickstart on a digital ocean server. But it fails at install profile step with the following error,

An AJAX HTTP error occurred. HTTP Result Code: 404 Debugging information follows. Path: http:///install.php?profile=commerce_kickstart&welcome=done&locale=en&use_dfp=1&id=1&op=do StatusText: Not Found ResponseText: 404 Not Found 404 Not Found nginx/1.0.15

I dont know what to do.  Please help.
I can install drupal easily with no issues but installing all modules for commerce is a headache so I decided against it.

NOTE:  is my website


texts: Why does drupal use .yml and not officially recommended .yaml

texts: Per yaml page https://yaml.org/faq.html they recommend .yaml as file extension but I see drupal uses almost exclusively .yml, how so? And does adding .yaml to file extension even work for drupal 8 or will it be skipped?


texts: Preprocess custom CCK fields and print image URL in TPL file

texts:
I want to preprocess a image field and later print it in my rss.tpl file and I'm currently using drupal 6.

This are the following codes I've tried in the template.php file but no luck :(

$vars['image'] = $field_uppdrag_logo;

&

/*$vars['image']=$node->field['field_uppdrag_logo'][0]['value'];

&

$vars['image'] = $node['field_uppdrag_logo'];*/

My tpl file:

<?php
// $Id: views-view-row-rss.tpl.php 3296 2009-05-27 23:08:21Z tim $
/**
* @file views-view-row-rss.tpl.php
* Default view template to display a item in an RSS feed.
*
* @ingroup views_templates
*/

?>
<item>
<title><?php print $title; ?></title>
<link><?php print $link; ?></link>

<description><?php
$description = html_entity_decode($description, ENT_QUOTES, "ISO-8859-1");
print strip_tags($description);
?>
</description>
<image>
<?php print $field_uppdrag_logo[0]['view']; print $image; print $field_uppdrag_logo;
?>
</image>
<?php print $item_elements; ?>
</item>

How exactly do I accomplish this?


texts: Node Create/Edit Form - Multistep with dynamic fields

texts:
Our site has different type of articles. Based on the type selected, the fields displayed to the user are varied. The ask is to create a multi-step form and include type field on step 1. Based on the type, subsequent steps and fields included in those steps need to vary.

An important ask is that they need the ability to change the type of the article after it has been created. So on day 1 they might create an article with type "single page" but later change it to "multi page" (Multi-page article has all fields in single page plus additional fields).

I looked at Multistep, msnf, webform and webform_conditional modules etc, but they didn't seem to provide the functionality I need. Is creating this using Form API the best approach? Any suggestion?

UPDATE1

Another important requirement: An article could have multiple (0 or many) sections and each section could have multiple subsections. What is the best way to model the content type? Create content type Section and Subsection and then use node references (article will have a nod reference to section; section will have a node reference to subsection)? Using node references, can one to many relationship be implemented?


texts: Strange debug prints appear in the system log

texts:
I have two Drupal 7 sites on an Apache server that are printing strange debug messages in a system log. The sites are set in their vhost config to use error logs within each local site folder, like the following.

/var/www/site1.com/log/errorlog
/var/www/site1.com/html/[drupal installation]
/var/www/site2.com/log/error.log
/var/www/site2.com/html/[drupal installation]

These error logs are fine and happy, but I am seeing a large number of entries in /var/log/messages. These debug lines look like the following.

  Feb  5 08:51:56 server012 drupal:
  http://site1.com|1391619116|form_debug|5.10.83.11|http://site1.com/eform/submit/apply-for-a-program?pid=127||0||Array#012(#012
  [#parents] => Array#012        (#012        )#012#012    [#entity] =>
  Entityform Object#012        (#012            [uid] => #012
  [entityType:protected] => entityform#012
  [entityInfo:protected] => Array#012                (#012
  [label] => Entityform#012                    [entity class] =>
  Entityform#012                    [controller class] =>
  EntityformController#012                    [base table] =>
  entityform#012                    [fieldable] => 1#012
  [entity keys] => Array#012                        (#012
  [id] => entityform_id#012                            [bundle] =>
  type#012                            [revision] => #012
  )#012#012                    [bundles] => Array#012
  (#012                            [apply_for_a_program] => Array#012
  (#012                                    [label] => Apply for a thing
  or Ask a Question#012                                    [admin] =>
  Array#012                                        (#012
  [path] => admin/structure/entityform_types/manage/%entityform_type#012
  [real path] =>
  admin/structure/entityform_types/manage/apply_for_a_program#012
  [bundle argument] => 4#012
  [access arguments] => Array#012
  (#012                                                    [0] =>
  administer fields attached to entityform entities#012
  )#012#012                                            [original access
  arguments] => Array#012
  (#012

  Feb  5 08:51:48 server012 drupal: http://site2.com|1391619108|content|90.8.28.253|http://site2.com/fr/node/2/edit|http://site2.com/fr/node/2/edit|44|voir|page: updated Qui sommes nous?.

I've just been informed that /var/log/messages is linux "syslog".

Why is Drupal printing to syslog?
Is this normal behavior?
Is there a setting to enable/disable syslog output?


texts: How to upload video to Drupal using Video module?

texts:
I've successfully installed the Video module and now there is no errors.

It's not clear to on Drupal website how I can start uploading videos though.

Can anyone please shed some light on this?


texts: Dynamic select list in the form API (dependent dropdown list)?

texts:
First I want to select State (like Tamil Nadu, Sikkim, Kerala) after selecting state, depended city list will be display another dropdown list ( for example Tamil Nadu -> Chennai, Salem, Karur and Kerala -> Trivandrum, Kochin etc)

Please help me please how to make it, here i have tried some coding but does not work, Please help me

Sstate - Table

$query_state = db_select('state', 's');
$query_state->fields('s',array('State_code','State_name'));
$query_state->orderBy('State_name','ASC');
$state_results = $query_state->execute();
$options_state = array();

foreach($state_results as $state_record) {
  $options_state[$state_record->State_code]=t($state_record->State_name);
}

$form['state'] = array(
  '#type' => 'select',
  '#title' => t('State'),
  '#options' => $options_state,
  '#required' => TRUE,
);

City - Table

$query_city=db_select('city', 'c');
$query_city->fields('c',array('District_Code','District_Name'));
$query_city->condition('State_Code','$state_record->State_code','=');
$query_city->orderBy('District_Name','ASC');
$city_results = $query_city->execute();
$options_city = array();

foreach($city_results as $city_record) {
  $options_city[$city_record->District_code]  =t($city_record->District_Name);
}

$form['city'] = array(
  '#type' => 'select',
  '#title' => t('District'),
  '#options' => $options_city,
  '#required' => TRUE,
  '#states' => array(
    'visible' => array(
      ':input[name="state"]' => array('value' => $options_state)
    )
  )
);


texts:
I would like to use the Remote File Source Module.

But I could not find any documentation related to it.

Has anyone succeeded using it?

How to provide ftp hyper link inside a blog, article, forum.

I would like to insert a node url inside CKEditor. The node must be a custom node which will fetch a file from an FTP url some think like a reverse proxy.


texts:
I've added the privatemsg module send message form in a php block, it's working fine but the page tittle and the metatag tittle now shows "write a new message to(user uid)" instead of the node tittle.

this is the code in the php block:

`<?php
 module_load_include('pages.inc','privatemsg');
 $node = node_load(arg(1));
 $recipients = strip_tags($node->uid);
 $subject = 'custom subject';
 print '
';
 print drupal_render(drupal_get_form('privatemsg_new', recipients,
 $subject));
 print "
";`

I can't figure out why this could be happening, i'm new to Drupal.

Thank you.

UPDATE

I've created a custom module as @burnsjeremy suggested, it works but the same error is happening.
Check the comment line in the code.

<?php
module_load_include('pages.inc','privatemsg');
function seb_privatemsg_block_info(){
    $block['seb_msg'] = array(
       'info' => t('Seb Private Msg'),
       'cache' => DRUPAL_NO_CACHE
    );
    return $block;
}
/**
* Implements hook_block_view().
*/
function seb_privatemsg_block_view($delta = '') {
    $block = array();
    $block['subject'] = '';
    $block['content'] = seb_privatemsg_content();
    return $block;
}
function seb_privatemsg_content() {
    $node = node_load(arg(1));
    $recipient = strip_tags($node->uid);
    $subject = 'custom subject';
    $output = '';
    // if i comment the following line the title is correct
    $output .= drupal_render(drupal_get_form('privatemsg_new', $recipient, $subject));
    return $output;
}

Any help would be greatly appreciated.


texts: Calculate the number of days since the creation date of a user account

texts:
I would like to calculate the number of days past since a users creation date. This is what I have done so far:

$user = \Drupal::currentUser();
$registrationdate = getdate($user->getCreatedTime());
$today = getdate();
$daypast = date_diff($regdate, $today);

This results in the following error:

  date_diff() expects parameter 1 to be DateTimeInterface

How can I solve this and get the number of days past since the users registration date?


texts: How do I add a class to a row based on the value of a field in that row?

texts:
I have a view with a page display showing a list of events. I'd like to add a class to the rows of those events that are in the past.

The problem I have is that views-view-list.tpl.php doesn't have access to the values of fields within the rows.

And I can use views-view-fields.tpl.php to check the date field of one row, and wrap each field in that row with a div or span based on whether or not the date field is in the past.

I just can't figure out how to use the value of a field within a row to wrap the whole row in something with a class.


texts: What modules do I need to add tokens in my content that references the current nodes field?

texts: I have a blog content type and I also have a taxonomy reference field for "color". How do I embed the field's color value in the body of my blog post via a token?


texts: how to create custom template for a product type in drupal 8 commerce

texts:
I want to have separate twig templates for each product type in drupal 8 commerce to customize them.

is there any way to do that?


texts:
I'm fighting with pathauto patterns for a particular content type. The content type is bound to a taxonomy (a product catalog). I thought that the taxonomy tree should only hold container items (categories, subcategories, subsubcategories, etc) but not the end-nodes (products), and that it'll be possible to have the following URL pattern, consisting of the container node url + product alias + extension, as in [taxonomy-alias]/[node-alias].html.

This appears to be a wrong assumption though and causing trouble and bogus aliases.
I'm closer to an approach that the taxonomy should descend down to the very product node, and product pages should be tagged with the final taxonomy node.

This however brings up a question: Is this a way to go if a product can fit in more than 1 category? This smells like more maintenance issues later, because if a product were to be removed, we would have to remove it in X places; my intuition tells me it's not the right way.

Above this all there is a goal to have the URLs and breadcrumb consistent, in sync.

I'm curious to know your opinion and experience in organizing a catalog taxonomy.


texts: Adding user reference field to $variables['submitted']

texts:
I'm having some difficulty identifying the variable name for a user reference field (in this case 'Web Author') that I've generated for a content type of 'article' so that I can use it in the 'submitted' area generated by template.php.

What's shown below was previously generated by someone else to allow for the string to link to articles by author, which is what I'd like to do right next to the previously generated author name. Can someone help me with identifying the proper syntax to put in and identify a user reference field? Thanks.

function c2n_preprocess_node(&$variables) {
//dpm($variables);

$variables['node_content_top'] = block_get_blocks_by_region('node_content_top');
$newname = strip_tags($variables['name']);
$webname = strip_tags($content['field_web_author']); //THIS IS WHAT I CAN'T FIGURE OUT
$newname_slug = preg_replace("/[\s-]+/", " ", strtolower($newname));
$webname_slug = preg_replace("/[\s-]+/", " ", strtolower($webname));
$newname_link = ''.$newname.'';
$webname_link = ''.$webname.'';
// reformat the submitted author/dateline
$variables['submitted'] = t('!username | !webname | @datetime', array('!username' =>
$newname_link, '!webname' => $webname_link,
'@datetime' => date("F j, Y g:i a", $variables['created'])));

}


texts:
My cron is stuck because "Drupal core update status :   No update data available", when disable update module, cron run good again.

Just try manual update but it run more than 3 minutes then nothing happen. I'm already clean cache_update and seasson table in database.

Go to /admin/reports/updates/list, all css on page gone and report Last checked: 0 sec ago.

I'm running Drupal 6. Please help/


texts: How to print formatted contents of Computed Field and Full HTML Textarea in a custom template?

texts:
I have used this code to print normal text fields in a print.tpl.php template file:

<?php if(isset($node->field_mytextfield['und'][0]['value'])) {
          print $node->field_mytextfield['und'][0]['value'];
            }
     ?>

But that same code will not work with Computed Fields I have set up in that same content type. The content type has a "Print" display type, and I have tried all of the Format options (Unsanitized, Plain Text, Filtered Markup, and Raw Value No Display Code) for the computed fields, to no avail. How can I print the formatted values of those computed fields, exactly as they are displayed by the actual fields themselves?

I also have a Textarea field that prints as a single line of unformatted text using the code above. How can I print the formatted value of that field when Full HTML is used to enter info into that field?

Thanks!


texts: How can i display total number of node created by individual user?

texts:
I have created one block by using view, which display author details on each node page, author details block on each node

Here is the link by which the block has been created,now i want to display total number of node  and total number of work viewed created by individual user on the same block which has been created above.

How to count the node a user has created in a View?
The way on this link is working fine for displaying all user but its not working after adding CONTEXTUAL FILTERS
(nodes) Content: Nid | Aggregation setting by which this block will be able to display on each node.

Please suggest something.

Thanks


texts: How do I get a list of all taxonomy terms assigned to a node (or any entity)?

texts:
What's the best way to get all taxonomy terms assigned to a node?

Should one use the taxonomy_index table?

Should one iterate through the fields on the node object?

I saw some answers for Drupal 7, but not for Drupal 8.


texts:
I had previously created a front facing page with a table that has a sticky header using Drupal's built in sticker header js.

Now, we are in the process of making that site responsive. To handle the tables we have set an overflow: scroll on the table container to create a horizontal scrollbar for the table.

However, the sticky header (because it is position fixed) does not scroll.

How can I implement Drupal's sticky header in a responsive site.

Code that generates the table:

$block['content'] = theme_table(
  array(
    'header' => $table_headers,
    'rows' => $table_rows,
    'attributes' => array(),
    'caption' => '',
    'empty' => '',
    'colgroups' => array(),
    'sticky' => TRUE,
  )
);


texts: What's the difference between private message & message?

texts:
In my user backend I have a tab named 'messages' (mysite.com/user/uid/messages) and a second named 'Private messages & invitation' (mysite.com/user/uid/contacts).

For what I see private messages is where users can message each others when there are trusted contact.

Now I want to know the use of 'Messages'. Also I've seen that there is two modules message & Privatemsg.


texts: Concatenate multiple fields in a hidden field

texts:
I want to capture multiple names and birthdays in Drupal 7.
Before submission, I want all of the names be auto-populated in another field (All Names), which should be hidden to users, but stored on the submission.
Is this possible?


texts: How do I make a link to a flag edit page?

texts:
I'm using Drupal 8 with Flag 4.0-beta1.
On my flag, I have several fields.  I want users to be able to edit these fields after making the flag.
How can I make a link to the flag edit page?
I found this comment on using VBO for Drupal 7, but on Drupal 8, VBO doesn't have the "modify entity" option for flaggings suggested in that post.
I tried various things in Views (making a view of flaggings; making a view of nodes with flaggings as a relationship), but I can't find a way to get an edit link.
EDIT: I got confused by the terminology and mixed up flags (the "type") and flaggings (the instance of the type) are different.  I'm leaving this question as is, and I created a new question for flaggings.


texts:
I have been building a Drupal 7 site on my Mac. Using PHPMyAdmin, I have exported a sql dump of the database. When I upload this sql file to my host, I get the following error message:

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 280
STR: =,
SQL:

-- --------------------------------------------------------

--
-- Table structure for table `themekey_properties`
--

CREATE TABLE `themekey_properties` (
  `id` int(10) UNSIGNED NOT NULL,
  `property` varchar(255) NOT NULL DEFAULT '',
  `operator` varchar(2) NOT NULL DEFAULT=,
) ;

SQL query:

-- -------------------------------------------------------- -- -- Table structure for table `themekey_properties` -- CREATE TABLE `themekey_properties` ( `id` int(10) UNSIGNED NOT NULL, `property` varchar(255) NOT NULL DEFAULT '', `operator` varchar(2) NOT NULL DEFAULT=, ) ;

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=,
)' at line 10

How would I go about debugging this? I have searched extensively, but not found any websites that explain how.

The website functions perfectly on my localhost. I have done this process hundreds of times before, and never had any problems.

I seem to have this exact problem when transfering other sites from my Mac to my host, so I am not sure if it is a global problem. The affected sites all use themekey module which is referenced in the error message, but I can't find anything online which indicates why themekey would be causing the problem.

Updated.

I followed the @Erin McLaughlin's answer, but now I get the following error:

CREATE TABLE `themekey_properties` (
  `id` int(10) UNSIGNED NOT NULL,
  `property` varchar(255) NOT NULL DEFAULT '',
   `operator` varchar(2) NOT NULL DEFAULT '=',
)
MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 5

Updated.

I followed @Erin McLaughlin's second suggestions, but now I get the following error:

SQL query:

INSERT INTO `themekey_properties` (`id`, `property`, `operator`, `value`, `weight`, `theme`, `enabled`, `wildcards`, `parent`, `module`) VALUES
(1, 'themekey_compat:module_system_triggers_theme', '=', 'static', 5, 'default', 1, 'a:0:{}', 0, 'themekey'),
(2, 'drupal:path', '=', 'user/#/edit', 2, 'default', 1, 'a:0:{}', 0, 'themekey')
MySQL said: Documentation

#1054 - Unknown column 'value' in 'field list'


texts: Autofill new content fields with previously created content

texts:
Gotta question that I bet has been done, but I cannot find a solution. :)

I have content types called POC (Points of Contact). The POC type has basic personal info like: first name, last name, address, phone number, fax, and email address. There are about 600 of those nodes.

Now, I have a form that users need to fillout and they will need to enter the names of their manager (using autocomplet widget with entity reference), hr rep, and administrator...all who are part of the POC nodes.

I would like for the users who fill out the form to use an auto-complete field for the name of each POC and the rest of that POC data to autofill the other required fields about that POC in the form.

Basically an autofill of POC data.


texts: Get path parameter in views-view-fields--portfolio.tpl.php file

texts: I am working on project. In project I am using view. print $field->content; parameter print image with link. I want path variable value in variable.


texts: How to build render array for image with custom link without using field_view_value()

texts:
In a custom module i implemented code to display a image which links to a custom destination. I got it working by building a render array with field_view_value():

Code snippet I:

$link = 'http://example.com';
$node = node_load($nid);
$image = field_get_items('node', $node, 'field_image');
$output = field_view_value('node', $node, 'field_image', $image[0], array(
  'type' => 'image',
  'settings' => array(
    'image_style' => 'thumbnail',
    'image_link' => 'content',
  ),
));
$output[0]['#path']['path'] = $link;

But since i have to use for some reason entity_metadata_wrapper() instead of field_view_value() to retrieve the values, i wrote following code:

Code snippet II:

$node_wrapper = entity_metadata_wrapper('node', $reference);
$link = $node_wrapper->field_image[0]->value();
$output = array(
  'type' => 'image',
  '#theme' => 'image_style',
  '#path' => $link,
  '#style_name' => 'thumbnail',
      'settings' => array(
      'image_style' => 'thumbnail',
      'image_link' => 'content',
    ),
);
$output['#path']['path'] = $link;

In this code, the image is shown but the link is not working. As you can see in the screenshots below, the render array generated differs in both snippets. What am i doing wrong in snippet II? How can i achieve the same array structure as in snippet I? Don't know if it is important to mention: Field 'field_image' is a file field provided by the file_entity module.

Using code snippet I:

Using code snippet II:


texts:
I've run into this both with 3rd party contrib modules as well as some of my own operations. I'm curious at the various ways to speed up my/contrib batch operations?

Assume they work with nodes (import/update etc) and we're dealing with parsing lists of nodes in the 10,000+ range (although I've had to deal with 15 million rows.. which yes - I'm just screwed on..)

Is it quicker to attach to drupals cron.php job and run "headless"? Using Drush? or is this simply a question of how efficient and quick parsing I can develop my code and there are no outside influences or batch specific optimization tips ...

Currently I've run into operations that (using some rough calculation) could take 24+ hours...

Thanks!


texts: How to manually delete a node from the database knowing its id

texts:
Well, look my problem is weird, I have a view that lists content of a desired type, it is listing all the content of a type, I have deleted from the drupal admin UI a node of that type, but the view is still listing the node I have deleted. If I try to access to that node from the view, I get an entityMetadataWrapperException

Now I cannot see the node in the drupal content admin UI.

I know the nid of this node (its 22) I need to delete it manually from the database, how to achieve this, is necesary a custom module or something?

Thank you very much for your help.


texts:
I want to save webform submissions in node table..

I want to use the solution from "How to create a node out of a webform submission?".

How can I implement it? I used hook_form_alter but it doesn't work.


texts: When to use mapping or sequence to define an array in a schema file?

texts:
I need to define an array in my onlyone.settings.yml file to store this values:

onlyone_node_types:
  book: book
  test: test

In my onlyone.schema.yml file I have this:

module.settings:
  type: config_object
  label: 'Only One settings'
  mapping:
    onlyone_node_types:
      type: sequence
      label: 'Configured content types to have Only One node'
      sequence:
        type: string
        label: 'Content type machine name'

But I don't know if I need to use a sequence or a mapping type in my case.

I read in the Configuration schema/metadata page this:

  Note that you may also encounter a slightly different sequence
  definition where the type of the sequence items is defined as a
  strictly one item list. This format is deprecated and will be removed
  in Drupal 9:

So, I don't know if I need to use mapping or sequence in my case to define my array.


texts:
I create a simple module to test hook_views_data but may I get some errors
this is my code

in tungcan.module file

function test_views_api() {
  return array(
    'api' => '3'
  );
}

and in tungcan.views.inc file

function tungcan_views_data() {
  $data = array();
  $data['tungcan']['table']['group'] = t('TungCan');
  $data['tungcan']['table']['basic'] = array(
    'field' => 'tungid',
    'title' => t('Tungcan'),
    'weight' => -100,
    'defaults' => array(
      'field' => 'tungname',
    ),
  );

  $data['tungcan']['tungname'] = array(
    'title' => t('Tung Name'),
    'help' => t('Display name of Tung')
  );

  return $data;
}

but when I clear cache, in my Views (add new views or add new Field) doesn't change anything.

Can somebody point out what is wrong in my code?


texts:
A few of our content pane titles need to be italicized because they contain book titles.

I've added an "italicize-title" class to the content pane in Panelizer > Content > Content Pane > CSS properties. This has some drawbacks. The main disadvantages are that the whole title is italicized and I have to manually add the class to each piece of content needing its title italicized.

I've tried the HTML Title module, but that didn't work.

Is there a way for me to allow content editors to use a limited number of html tags in a content pane's title field?

Thank you for looking...


texts:
I would like every node created to have a unique ID. What's the best way to go about this? I know of the UUID module, but I don't really want the IDs to be formatted like a UUID. Does there exist a module that creates a unique ID that looks like (for example) an md5 hash?

The reason for doing this is that information about certain nodes has to be passed around between a few servers (in emails in some cases) and I don't wan't people to be able to have access to the drupal server's systems, I'd rather them see something like a hash as opposed to drupal's nid.


texts: How to update drupal by drush automatically

texts: In common use,after typing "drush up drupal" it need type "yes" for confirm.If I need to use Linux's cron to run drush automatically,how to bypassing the confirm part?


texts: Exposed proximity filter in geofield required, but still gives result

texts:
I've made a view with geofield proximity search. The user needs to fill in a location before I want to show result. So I made the exposed filter required:

But the view gives result, even when nothing is filled in. This is the query created:

SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language, 'node' AS field_data_field_adres_node_entity_type, 'node' AS field_data_field_location_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_location} field_data_field_location ON node.nid = field_data_field_location.entity_id AND (field_data_field_location.entity_type = 'node' AND field_data_field_location.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('dealer')) ))
LIMIT 2 OFFSET 0

How can I make sure the query doesn't run if nothing is filled in?


texts:
i tried openframework for D7 and i like is responsive capacity and its usage.So i would like to use it for my D6 websites not upgraded yet.

I get the D6 version from GitHub
but i don't find any instructions about using it, do i create a subtheme like for D7 ? Do exist a documentation for D6 version ?


texts: Trying to submit a node add form via AJAX but failing

texts:
I'm simply trying to submit a node add form via AJAX:

function input_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'page_node_form':
      $form['actions']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
        '#ajax' => array(
            'wrapper' => 'apple-node-form',
            'callback' => 'node_add_callback',
            'method' => 'replace',
            'effect' => 'fade'
        )
      );
      break;
  }
  return;
}

function node_add_callback(){
  $node = new stdClass();
  $node->type = 'page';
  return drupal_get_form('node_form', $node);
}

input_form_alter() DOES get called. And when I click the submit button, I even see the standard ajax gif and "Please wait" message. The gif and wait message then disappear, as expected. However, no new node has actually been created.


texts:
I am trying to make php show error notices, but it doesn't work. For my error settings I have write errors to screen and log.

I tried this: (in page.tpl.php)

error_reporting(E_ALL);
ini_set('display_errors', 'on');
$abc = array();
echo $abc['test'];


texts: Is it possible to call custom code from a panel? My custom module has a function which returns some content. I wish to call this from my panel.


texts: Taxonomy formatter that shows a list of links to related nodes

texts:
I have a Taxonomy field on a Node. In the display of the node, I'd like a list of links to other related nodes, not a link to the Taxonomy category.

Is it best to build or find a formatter that can do this?

Or, is it best to make a View, and if so, what is the proper way to enforce the relationship between the selected Taxonomy Term item in the Node and the View?

Update: I found another StackOverflow answer. Though seemingly complex (I don't yet understand how it works), the initial results are promising.


texts: My page showing up with a title, but with the content div empty, but only for users

texts:
I've created a new content type that has the default 4 fields (Title, Body, Meta tags, URL path settings) and one List(integer) that I added.  I called it "Basic page".

When I create a new Basic page node and put in some data, it will work as long as I'm logged in as admin.  If I log in as any other user, the page title will show up, but the body will be blank.

The content div for a user is actually completely empty.  The admin has content for it, but any other user does not.

New Test Page

I've looked through the user permissions for this node type, and that doesn't seem to be affecting anything (though I could have easily missed something).  The display isn't set to . I'm using Drupal 7.


texts: External URL Redirect Breaking Image Links

texts:
I was recently hired to manage an existing Drupal 7 site (built with an Omega subtheme) and am doing my best to ramp up quickly. Unfortunately, I do have some fires to put out immediately and could really use some help. The website has redirects coming in from another hosting provider/domain manager. For example, www.oldsite.com is being redirected to www.currentdrupalsite.com (currentdrupalsite.com being the site that I am managing) from a different host than the one that the current Drupal site is being hosted on. This redirect is breaking my image links, specifically the logo.

So, the img src path is http://oldsite.com/sites/all/themes/themename/logo.png instead of http://currentdrupalsite.com/sites/all/themes/themename/logo.png.

Can I fix this through the Drupal interface?


texts: Show a discount field in the Product display page

texts:
I want to apply some discounts on products.
I know the Commerce discount module and its UI.
However,it would be much simpler for the site admin to have a second field on the product display for the discount-new lower price.
Is this possible to do?If so how?
thanks


texts:
I'm trying to output the main_menu in to a custom theme on the page.tpl.php template however nothing is displaying when I add <?php print theme("links", $main_menu) ?>

However when I do a var_dump on the $main_menu I get

array(2) { ["menu-218"]=> array(2) { ["href"]=> string(7) "" ["title"]=> string(4) "Home" } ["menu-335"]=> array(2) { ["href"]=> string(6) "node/1" ["title"]=> string(4) "Home" } }

What might I be doing wrong? I'm new to Drupal so be kind please :D

I do have features[] = main_menu in my .info file.


texts:
I want to build a filter for a custom module I built and have integrated with views. In essence, the module allows you to define types of relationships between different nodes. I'd like to create a filter for this so that I can display nodes of a certain type of relationship.

I'm not finding any documentation that describes filters in more detail and explaining the various parts to them. The API documentation is horrific in this regard.

Can anyone suggest a good resource/article on building View Filters in detail?


texts: Core Update: Which Is Safer, Patching or Drush?

texts:
We have a number of production sites (mostly on one AWS instance) that require an update of Drupal Core from 7.34 to 7.35.

I have tested an update on one development instance using the following drush command:

drush up drupal

I also have tested an update on another development instance using a patch from this site:
http://fuerstnet.de/en/drupal-upgrade-easier
The commands were:

patch -p1 --dry-run < drupal-7.34-to-7.35.patch

patch -p1 < drupal-7.34-to-7.35.patch

There are no db updates involved.

It seems to me that on the one hand, drush backs up the core files but on the other hand, the patch is faster.

So, which would be safer?


texts:
Is there a way to Add autocomplete to Node Titles?

This way I could display duplicate content to users before they add a new post.

Any suggestions?


texts:
I'm using drupal's form API as part of a block in my module.

When the form is submitted, I want to change the content of the block to something else, let's say "Thanks". I do not want the page to redirect, as is default behaviour.

(Admittedly the default behaviour has the benefit of removing the POSTed page from the browser History, so you don't get questioned on hitting Back.)

If not clear, please let me know and I'll post a code sample.


texts: How do I pass the language through ajax request

texts:
I have an ajax function in the javascript file that calls for the data in a custom module. But the problem is it always get the data for the default language. In my case it is 'en'. How do I get the data for another language.

$language = \Drupal::languageManager()->getCurrentLanguage()->getId();

This method always returns the default language for ajax requests. How do I get the data for the language that is mentioned in the url.

ajax:

$.ajax({
    url: "/gallery/view",
    method :'POST',
    data: {
        category : category,
        propertyId : propertyId,
        isCorporate : isCorporate,
        brandId : brandId,
    },
    success: function(result){}
});

routing :

eme_gallery.view:
  path: '/gallery/view'
  defaults:
      _controller: 'Drupal\eme_gallery\Controller\ViewGalleryImage::view'
      _title: 'Image Gallery'
  requirements:
      _permission: 'access content'


texts: How to change the operator for a views contextual filter?

texts:
I am using the views module to present data as a table (block) from a mysql database. The table is filtered based on the raw value from the pages URL path. View only allows for the contextual filter to be an exact match to the field value.

How can I change this operator to "LIKE"?

Currently I added this custom views query which should alter the views query

<?php

/**
 * Implements hook_views_query_alter
 *
 * Finds the correct view, and calls a relevant callback
 */
function customviewsquery_views_query_alter(&$view, &$query) {
switch($view->name) {
case 'alkon_valikoima_ryp_le':
  _customviewsquery_my_view_name_views_query_alter($view, $query);
  break;
}
}

/**
* Callback to fix the Views 3 query object before execution
*/
function _customviewsquery_my_view_name_views_query_alter(&$view, &$query) {
// Loop through the conditional parts of the query, and
// * Change = to LIKE
// * Add SQL wildcard characters to both sides of the value
foreach($query->where as $key => $val) {
$field = $val['conditions'][0]['field'];
$operator = $val['conditions'][0]['operator'];
$value = $val['conditions'][0]['value'];

if($field == 'alko_tb.grape_alko' && $operator == '=') {
  $query->where[$key]['conditions'][0]['operator'] = 'LIKE';
  $query->where[$key]['conditions'][0]['value'] = '%' . $value . '%';
}

}
}

The machine name for my view is "alkon_valikoima_ryp_le" and the field is the database "alko_tb" under the "grape_alko" column.

What could be wrong with this approach?


texts: All of my pages have class "page--node-" on the body element. This doesn't seem right

texts:
I'm trying to track down the source of some CSS issues I'm having on my site and I noticed that every page has class "page--node-" added to the <body> element. The theme hook suggestions seem to include page__node__%.

This looks weird. Is it supposed to be like this, or is there a problem in a theme hook suggestion generated somewhere? I'm using a subtheme of Zen 5.


texts: "Promoted to Front Page" option only showing for administrator

texts:
I am using the "Promoted to Front Page" option for a view that is displayed on a landing page. The option shows in the create/edit form for an administrator, but no other user for the article content type. My "site admin" role allows the user to create/edit own/others for this content type. I am using the group module which is installed for this content type as well as content moderation. This user is assigned to a group with a group role that has permissions for all moderation states. I have looked through all permissions and I don't see a permission to use this. The promoted to front page option is enabled in the manage form display.

Drupal 8.7.7


texts: Custom Theming Bootsrap Carousel with Paragraph Type

texts:
Background Info:
I tried to create a custom theme for my carousel section and I am unable to get it to work. I have tried using the default carousel that Drupal comes with. I have tried using slide show views. Also I already know about Jim Bir's Custom Bootstrap Carousel and Slick Carousel but I am unable to use them since these extensions are still in Beta.
Problem Statement:
The main avenue that I want to try to do is create a paragraph type called Carousel Section that has a reference to another paragraph type called `Caraousel Slide'.
I wanted to use this design so that way I can organize the slides individually on my pages.
Within the Carousel Slide paragraph type it would have the following fields:

Slide Image
Slide Title
Slide Description
Slide Link(which is the location of where the slide will take you if you click on it.)

I would like to use a preprocessor hook do get grab these values from Drupal and display them in my twigg file.
Question:
How can I achieve my problem statement? The bare minimal knowledge that I need is to how to at least get these fields to present themselves on my twig file and from there I can use HTML and CSS to make the carousel.